Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crashdump caused by unexpected halt(undefined, undefined) #8634

Open
zzydxm opened this issue Jul 2, 2024 · 2 comments
Open

crashdump caused by unexpected halt(undefined, undefined) #8634

zzydxm opened this issue Jul 2, 2024 · 2 comments
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@zzydxm
Copy link
Contributor

zzydxm commented Jul 2, 2024

Describe the bug
Sometimes during node shutdown we see such Slogan:

⁠ Slogan: System process <0.0.0> terminated: {badarg,[{erlang,halt,[undefined,undefined],[{error_info,#{cause=>badopt,module=>erl_erts_errors}}]},{erlang,halt,0,[]}]}

It seems that when init.erl calls halt() as the last step of shutdown, somehow it results in a halt(undefined, undefined)

We think it is caused by this line https://github.com/erlang/otp/blob/OTP-26.2.3/erts/emulator/beam/bif.c?fbclid=IwZXh0bgNhZW0CMTEAAR3G8wFBshuPgBzFHroABMARgLPYBKZZpU42C_f6CAwxYnTxsRIAT_a__l4_aem_sExFv1tZJSqb_KTxH1r0LQ#L4307

but not sure in which situation the line will (should) be called

To Reproduce
We haven't a way to reproduce it yet, just wonder what can be the cause so we can dive deeper, thanks!

Expected behavior
The node should be shut down gracefully

Affected versions
26.2.1

@zzydxm zzydxm added the bug Issue is reported as a bug label Jul 2, 2024
@sverker sverker self-assigned this Jul 3, 2024
@sverker
Copy link
Contributor

sverker commented Jul 3, 2024

There seem to be a possibility for race in BIF halt_2. If two or more calls are done "at the same time" only one will succeed the cmpxchg operation in erts_halt() at

if (-1 == erts_atomic32_cmpxchg_acqb(&erts_halt_progress,

the other(s) will return from erts_halt and may actually do the scheduled halt(undefined,undefined) call, which is not supposed to happen, before the scheduler gets halted.

#8640 is a proposed fix that suspends the calling process.

@zzydxm
Copy link
Contributor Author

zzydxm commented Jul 3, 2024

Ah I see, thanks a lot for the fix!

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants