No description
Find a file
Stephen Dennis 9f2cf6274b fix: avoid fork() deadlock from alarm mutex in helper children
Backport of the 2.14 fix (0c413ffc) to the 2.13 layout.

The alarm clock is a std::thread + condition_variable whose mutex is
taken on every command via set()/clear(). The post-fork database-dump
child (game.cpp) and stubslave child (ganl_adapter.cpp) called
alarm_clock.clear(), which locks that mutex. fork() copies only the
calling thread, so a child that forked during the alarm thread's brief
mutex window inherits the mutex locked with no owner and self-deadlocks
in clear() before exec; a later stubslave reboot then blocks the parent
forever in waitpid(stubslave_pid, NULL, 0), parking the whole network
loop until a manual restart.

- Child side (root cause): reset the lock-free, async-signal-safe
  alarm_clock.alarmed flag instead of taking the mutex, in both fork
  children.
- Defense in depth: bound the two stubslave waitpid() calls via
  reap_child_bounded() (WNOHANG poll, then SIGKILL).

2.13 has no platform.cpp helper-process child, so only the dump and
stubslave children need the change. The legitimate main-thread
alarm_clock.clear() calls in netcommon.cpp and cque.cpp are unchanged.
Verified: game.o and ganl_adapter.o compile clean with -DSTUB_SLAVE.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 04:33:15 +00:00
client Replace getpagesize() ifdef cascade with sysconf(_SC_PAGESIZE). 2026-03-03 16:30:37 -07:00
color Update stale kdtree validation routine. Tree itself is fine. 2011-01-14 19:43:53 -08:00
contrib/TinyMUX.Win32 Remove Byte Order Mark (BOM). 2010-05-10 21:43:36 -07:00
db Fix db/ test suite for current API and add null-safety to GetAttribute 2026-03-05 23:11:03 -07:00
debian Changes from Debian 2.10.1.14-1 package. 2017-10-09 09:38:58 -06:00
docker Update version numbers everywhere to refer to 2.13 instead of 2.12. 2020-08-11 07:38:56 -06:00
docs docs: GANL connection lifecycle bugs — pure virtual fixed, double-free documented 2026-03-14 10:01:33 -06:00
mux fix: avoid fork() deadlock from alarm mutex in helper children 2026-07-15 04:33:15 +00:00
muxsvc Add work-in-progress for Windows service. 2008-12-11 16:57:29 -08:00
sgp Remove hardtabs. 2012-05-18 13:29:49 -07:00
specs Add clean target to specs Makefile. 2010-06-02 20:34:17 -07:00
testcases Backport: @listen %0 retains fancy quotes (from brazil aa40a46c3) 2026-03-18 21:08:05 -06:00
unix Bump version to 2.13.0.14 and remove BETA tag 2026-05-01 08:48:21 -06:00
utf Backport Unicode performance: combined CCC+NFCQC DFA, collation fast paths 2026-03-24 22:24:00 -06:00
win32 Bump version to 2.13.0.14 and remove BETA tag 2026-05-01 08:48:21 -06:00
.gitattributes Add .gitattributes to enforce LF endings for shell scripts and TOC files. 2026-03-04 08:05:14 -07:00
.gitignore Expand gitignore for release artifacts and testcases runtime 2026-05-01 09:08:30 -06:00
CLAUDE.md Update documentation for 2.13 release: dates, build process, defaults. 2026-03-03 06:36:11 -07:00
dounix.sh Bump version to 2.13.0.15 2026-07-15 04:12:26 +00:00
dowin32.sh Bump version to 2.13.0.15 2026-07-15 04:12:26 +00:00