Branch: fix-socket-race
Revision: f5c029ce26a8f0ed9209801dcfb64f0571073a85
Author: jabraham17
Merged at: 2026-11-05T20:55:16Z
Link: Fix race on socket module init/deinit by jabraham17 · Pull Request #29655 · chapel-lang/chapel · GitHub
Log Message:
Fix race on socket module init/deinit
Fixes a race in the Socket module on init/deinit.
On init, a pthread is started whose dispatchLoop checks event_base_got_break() and then calls event_base_loop(). libevent's event_base_loop() resets the break flag to 0 when it starts. So if the module's deinit() calls event_base_loopbreak() after that check but before the loop starts, the break is lost. The loop runs forever and pthread_join hangs
To fix it, the break is now queued as a one-shot event, that event then calls event_base_loopbreak
[Reviewed by @benharsh]
Diff:
M modules/packages/Socket.chpl
https://github.com/chapel-lang/chapel/pull/29655.diff