logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Bartnikowski" <sbartnikow...@barkinglizards.com>
Subject possible race condition with forked process
Date Wed, 15 Nov 2006 20:17:46 GMT

I'm essentially calling LOG4CXX_INFO in a child process between a call to
fork() and a call to execv() on FreeBSD 6.0.  The child process blocks
indefinitely maybe 1 in 4 times upon calling the LOG4CXX_INFO macro.  If it
doesn't block there, log4cxx calls after the execv work fine.  If I remove
the call between the fork and execv, then I never encounter the problem.

I was using 0.9.7, so I was hoping the latest from SVN would fix my issue.
However, upgrading did not improve the situation.  I am interested to try
this on my Linux machine, but it will take some time to get the latest
log4cxx installed on there as well.

Would there be any race conditions involved in calling LOG4CXX_INFO using
the parent's logger object between a fork and exec?  I know the parent's
memory is supposed to be copied for the child after the fork, rather than
shared, but I can imagine something could get broken in the copy-on-write,
or maybe mutex initialization, or even static data.


View raw message