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

Race during the process self-termination and terminate via supervisor #5193

Closed
juise opened this issue Sep 10, 2021 · 1 comment · Fixed by #5201
Closed

Race during the process self-termination and terminate via supervisor #5193

juise opened this issue Sep 10, 2021 · 1 comment · Fixed by #5201
Assignees
Labels
bug Issue is reported as a bug in progress team:VM Assigned to OTP team VM
Milestone

Comments

@juise
Copy link
Contributor

juise commented Sep 10, 2021

Describe the bug
In case process (gen_server) terminates with {stop, normal, ...} and the supervisor tries to stop it at the same time via terminate function, it's possible in rare cases to get:

   supervisor: {local,my_sup}
   errorContext: shutdown_error
   reason: noproc
   offender: [{pid,<0.4890.1539>},
              {id,my},
              {mfargs,{my,start_link,[]}},
              {restart_type,temporary},
              {shutdown,5000},
              {child_type,worker}]
(supervisor:do_terminate/2)

see http://erlang.org/pipermail/erlang-questions/2021-September/101433.html

To Reproduce
Create processes with a high rate, do self-termination and simultaneously terminate via supervisor.

Expected behavior
When a process terminates with a normal reason, the supervisor which tries to terminate it at the same time (monitors it), should get the real termination reason, not a 'noproc' reason.

Affected versions
OTP-23.2.5

Additional context
http://erlang.org/pipermail/erlang-questions/2021-September/101433.html

@juise juise added the bug Issue is reported as a bug label Sep 10, 2021
@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Sep 10, 2021
@rickard-green rickard-green self-assigned this Sep 13, 2021
@rickard-green rickard-green linked a pull request Sep 15, 2021 that will close this issue
rickard-green added a commit that referenced this issue Sep 29, 2021
…5201/OTP-17649' into maint

* Maria-12648430/supervisor_unlink_child_late/GH-5193/PR-5201/OTP-17649:
  Keep supervisor children linked during shutdown
@rickard-green rickard-green added this to the OTP-24.1.1 milestone Sep 29, 2021
rickard-green pushed a commit that referenced this issue Sep 30, 2021
…5201/OTP-17649' into maint-24

* Maria-12648430/supervisor_unlink_child_late/GH-5193/PR-5201/OTP-17649:
  Keep supervisor children linked during shutdown
@rickard-green
Copy link
Contributor

Now fixed in the just released OTP 24.1.1 patch.

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 in progress team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants