Opened 10 years ago

Closed 10 years ago

#529 closed defect (invalid)

Potential trouble with exit after fork

Reported by: Markus Hahn Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.5.x
Keywords: fork exit ngx_daemon Cc:
uname -a: Darwin a484.hound 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
nginx -V: nginx version: nginx/1.5.11
TLS SNI support enabled
configure arguments: --prefix=/usr/local --with-http_mp4_module --with-pcre=../pcre-8.34 --with-cc-opt='-m32 -arch i386 -mmacosx-version-min=10.7' --with-ld-opt='-m32 -arch i386 -mmacosx-version-min=10.7' --with-openssl=../openssl-1.0.1f --with-http_ssl_module --with-http_gzip_static_module


According to the fork() documentation the parent process (n ./src/os/unix/ngx_daemon.c) should call _exit() and not exit(). We got a random crash recently (not reproducible unfort.) with the crash point being somewhere in the finalization stage:

2 libsystem_c.dylib 0x9a3c5f0b cxa_finalize + 183
3 libsystem_c.dylib 0x9a3c6236 exit + 31
4 nginx.dylib 0x07bda79d ngx_daemon + 173
5 nginx.dylib 0x07ba83a1 main + 1377

This is just a suspicion that it might have something to do with the way nginx exits.

Change History (1)

comment:1 by Maxim Dounin, 10 years ago

Resolution: invalid
Status: newclosed

The fork() documentation as available in POSIX doesn't list any restrictions on using exit() after a fork(). You are likely confused it with atexit().

Note: See TracTickets for help on using tickets.