gleam-lang / otp

📫 Fault tolerant multicore programs with actors
https://hexdocs.pm/gleam_otp/
Apache License 2.0
414 stars 45 forks source link

`handle_exit` called with missing `starter` causes a crash #67

Open tomalexhughes opened 1 month ago

tomalexhughes commented 1 month ago

Creating an issue for this problem discussed in the Discord.

It's possible for the handle_exit function in the supervisor module to be called with state that is missing the starter.exec function.

This causes the following error due to this let assert

Runtime terminating during boot ({#{function=><<"handle_exit">>,line=>303,message=><<"Assertion pattern match failed">>,module=><<"gleam/otp/supervisor">>,value=>none,gleam_error=>let_assert},[{'gleam@otp@supervisor',handle_exit,2,[{file,"/[....]/build/dev/erlang/gleam_otp/_gleam_artefacts/gleam@otp@supervisor.erl"},{line,235}]},{'gleam@otp@actor',loop,1,[{file,"/[....]/build/dev/erlang/gleam_otp/_gleam_artefacts/gleam@otp@actor.erl"},{line,150}]}]})

Unfortunately I do not have a way to reproduce at the moment and I'm unsure as to the exact details that cause the none value.

lpil commented 1 month ago

Thank you.

ghivert commented 1 month ago

FYI, I have a regular error on Gloogle due to this error, because I'm exiting normally some children. That triggers server to restart. It's not a big deal at the moment, but it's bothering enough I'd like to fix it. Are you interested in some PR @lpil ? In case you are, do you have some opinions or some hints to get started on the subject?

lpil commented 3 weeks ago

PRs welcome but I've not investigated this.