]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: workaround an eglibc bug which truncates the pidfiles when nbproc > 1
authorWilly Tarreau <w@1wt.eu>
Wed, 5 Sep 2012 06:02:48 +0000 (08:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 5 Sep 2012 13:04:20 +0000 (15:04 +0200)
commit269ab318ef92bd7a70e474df918c1f72d2a17a5a
treecc73a909a1b87bdc5949ff2baff68f2b1d333ad9
parentee2e3a4027e3a35c43790667a8d61865d93f7ec3
BUG/MEDIUM: workaround an eglibc bug which truncates the pidfiles when nbproc > 1

Thomas Heil reported that when using nbproc > 1, his pidfiles were
regularly truncated. The issue could be tracked down to the presence
of a call to lseek(pidfile, 0, SEEK_SET) just before the close() call
in the children, resulting in the file being truncated by the children
while the parent was feeding it. This unexpected lseek() is transparently
performed by fclose().

Since there is no way to have the file automatically closed during the
fork, the only solution is to bypass the libc and use open/write/close
instead of fprintf() and fclose().

The issue was observed on eglibc 2.15.
src/haproxy.c