Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
1085-stdlib-customize-unlink_flush-for-noproc-s...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1085-stdlib-customize-unlink_flush-for-noproc-scenario.patch of Package erlang
From 51e3c384854e2bc27fd82bbd016ea52d4556f03d Mon Sep 17 00:00:00 2001 From: Jakub Witczak <kuba@erlang.org> Date: Wed, 11 Sep 2024 16:55:27 +0200 Subject: [PATCH 1/2] stdlib: customize unlink_flush for noproc scenario - handle termination race in supervisor - race happens when supervisor shutdown procedure - collides with child terminating from other reason - - in ssh tests this happens when client closes connection - which propagates to server over network - and results with termination of connection processes on server side - in parallel, server being is shutdown during test cleanup --- lib/stdlib/src/supervisor.erl | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl index 58b943d874..bb1b245634 100644 --- a/lib/stdlib/src/supervisor.erl +++ b/lib/stdlib/src/supervisor.erl @@ -968,16 +968,25 @@ shutdown(#child{pid=Pid, shutdown=Time} = Child) -> end end. -unlink_flush(Pid, DefaultReason) -> - %% We call unlink in order to guarantee that the 'EXIT' has arrived - %% from the dead process. See the unlink docs for details. +unlink_flush(Pid, noproc) -> + {links, Ls} = process_info(self(),links), + Timeout = case lists:member(Pid, Ls) of + true -> infinity; + false -> 0 + end, + receive + {'EXIT', Pid, ExitReason} -> + ExitReason + after Timeout -> + naughty_child + end; +unlink_flush(Pid, ExitReason) -> unlink(Pid), receive - {'EXIT', Pid, Reason} -> - Reason - after 0 -> - DefaultReason - end. + {'EXIT', Pid, _} -> ok + after 0 -> ok + end, + ExitReason. %%----------------------------------------------------------------- %% Func: terminate_dynamic_children/1 -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor