gleam
gleam copied to clipboard
Module metadata being loaded multiple times
I successfully ran the project and exited by pressing Ctrl+C. Then, when I run gleam run
the following error is displayed:
/private/tmp/gleam-20220628-94884-o8g5z1/gleam-0.22.1/compiler-core/src/build/project_compiler.rs:348
Metadata loaded for already loaded module: Module { name: ["gleam", "set"], origin: Src, package: "gleam_stdlib", types: {"Set": TypeConstructor { public: true, origin: SrcSpan { start: 0, end: 0 }, module: ["gleam", "set"], parameters: [Var { type_: RefCell { value: Generic { id: 1 } } }], typ: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 1 } } }] } }}, types_constructors: {"Result": ["Ok", "Error"], "Bool": ["True", "False"], "Set": ["Set"]}, values: {"fold": ValueConstructor { public: true, variant: ModuleFn { name: "fold", field_map: Some(FieldMap { arity: 3, fields: {"over": 0, "from": 1, "with": 2} }), module: ["gleam", "set"], arity: 3, location: SrcSpan { start: 3260, end: 3367 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 12 } } }] }, Var { type_: RefCell { value: Generic { id: 11 } } }, Fn { args: [Var { type_: RefCell { value: Generic { id: 11 } } }, Var { type_: RefCell { value: Generic { id: 12 } } }], retrn: Var { type_: RefCell { value: Generic { id: 11 } } } }], retrn: Var { type_: RefCell { value: Generic { id: 11 } } } } }, "union": ValueConstructor { public: true, variant: ModuleFn { name: "union", field_map: Some(FieldMap { arity: 2, fields: {"of": 0, "and": 1} }), module: ["gleam", "set"], arity: 2, location: SrcSpan { start: 4782, end: 4857 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 5 } } }] }, App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 5 } } }] }], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 5 } } }] } } }, "intersection": ValueConstructor { public: true, variant: ModuleFn { name: "intersection", field_map: Some(FieldMap { arity: 2, fields: {"of": 0, "and": 1} }), module: ["gleam", "set"], arity: 2, location: SrcSpan { start: 5215, end: 5304 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 4 } } }] }, App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 4 } } }] }], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 4 } } }] } } }, "new": ValueConstructor { public: true, variant: ModuleFn { name: "new", field_map: None, module: ["gleam", "set"], arity: 0, location: SrcSpan { start: 586, end: 613 } }, type_: Fn { args: [], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 6 } } }] } } }, "from_list": ValueConstructor { public: true, variant: ModuleFn { name: "from_list", field_map: None, module: ["gleam", "set"], arity: 1, location: SrcSpan { start: 2600, end: 2654 } }, type_: Fn { args: [App { public: true, module: [], name: "List", args: [Var { type_: RefCell { value: Generic { id: 7 } } }] }], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 7 } } }] } } }, "delete": ValueConstructor { public: true, variant: ModuleFn { name: "delete", field_map: Some(FieldMap { arity: 2, fields: {"from": 0, "this": 1} }), module: ["gleam", "set"], arity: 2, location: SrcSpan { start: 1837, end: 1909 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 9 } } }] }, Var { type_: RefCell { value: Generic { id: 9 } } }], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 9 } } }] } } }, "take": ValueConstructor { public: true, variant: ModuleFn { name: "take", field_map: Some(FieldMap { arity: 2, fields: {"from": 0, "keeping": 1} }), module: ["gleam", "set"], arity: 2, location: SrcSpan { start: 4206, end: 4286 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 10 } } }] }, App { public: true, module: [], name: "List", args: [Var { type_: RefCell { value: Generic { id: 10 } } }] }], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 10 } } }] } } }, "filter": ValueConstructor { public: true, variant: ModuleFn { name: "filter", field_map: Some(FieldMap { arity: 2, fields: {"in": 0, "for": 1} }), module: ["gleam", "set"], arity: 2, location: SrcSpan { start: 3787, end: 3877 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 14 } } }] }, Fn { args: [Var { type_: RefCell { value: Generic { id: 14 } } }], retrn: App { public: true, module: [], name: "Bool", args: [] } }], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 14 } } }] } } }, "size": ValueConstructor { public: true, variant: ModuleFn { name: "size", field_map: None, module: ["gleam", "set"], arity: 1, location: SrcSpan { start: 823, end: 859 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 8 } } }] }], retrn: App { public: true, module: [], name: "Int", args: [] } } }, "insert": ValueConstructor { public: true, variant: ModuleFn { name: "insert", field_map: Some(FieldMap { arity: 2, fields: {"into": 0, "this": 1} }), module: ["gleam", "set"], arity: 2, location: SrcSpan { start: 1070, end: 1142 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 13 } } }] }, Var { type_: RefCell { value: Generic { id: 13 } } }], retrn: App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 13 } } }] } } }, "to_list": ValueConstructor { public: true, variant: ModuleFn { name: "to_list", field_map: None, module: ["gleam", "set"], arity: 1, location: SrcSpan { start: 2274, end: 2322 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 3 } } }] }], retrn: App { public: true, module: [], name: "List", args: [Var { type_: RefCell { value: Generic { id: 3 } } }] } } }, "contains": ValueConstructor { public: true, variant: ModuleFn { name: "contains", field_map: Some(FieldMap { arity: 2, fields: {"in": 0, "this": 1} }), module: ["gleam", "set"], arity: 2, location: SrcSpan { start: 1445, end: 1510 } }, type_: Fn { args: [App { public: true, module: ["gleam", "set"], name: "Set", args: [Var { type_: RefCell { value: Generic { id: 2 } } }] }, Var { type_: RefCell { value: Generic { id: 2 } } }], retrn: App { public: true, module: [], name: "Bool", args: [] } } }}, accessors: {} }
Code that produces the crash:
import gleam/erlang/process
import gleam/http/cowboy
import gleam/http/response.{Response}
import gleam/http/request.{Request}
import gleam/bit_builder.{BitBuilder}
// Define a HTTP service
//
pub fn my_service(_request: Request(t)) -> Response(BitBuilder) {
let body = bit_builder.from_string("Hello, world!")
response.new(200)
|> response.prepend_header("made-with", "Gleam")
|> response.set_body(body)
}
// Start it on port 3000!
//
pub fn main() {
let _r = cowboy.start(my_service, on_port: 3000)
process.sleep_forever()
}
Hello! Could you share the full project? It's not that code that is causing the issue.
The project is at https://github.com/devmuroid/app_gleam.
Thank you
I've been unable to reproduce with that project. Is it still in a bad state on your machine? Would you be able to send me a list of all the files within it? find . > files.txt
Hmm, I can only see one metadata file for gleam/set
there. I don't have any ideas for how this could be happening.
I wonder if it's related to these .icloud files, perhaps another program was concurrently making modifications to the build directory.
I've reworked build locking and module loading, please reopen if this returns.