Re: [Libevent-users] Forked processes and signals

2011-03-08 Thread Nick Mathewson
On Tue, Mar 8, 2011 at 3:58 AM, Christophe Fillot wrote: > Nick Mathewson wrote: >> The real fix is to make event_base_free() a bit smarter about the >> epoll case.  This seems tricky; it probably wants to be a 2.1 fix, >> since there is a workaround for 2.0.  I've opened a bug ticked so this >> d

Re: [Libevent-users] Forked processes and signals

2011-03-08 Thread Christophe Fillot
Nick Mathewson wrote: Aha. My testing was off, this makes more sense now. The problem is indeed epoll-backend related. The problem is that after the fork, the subprocess shares the epoll fd with the parent process, and these both refer to the same kernel epoll structure. Ordinarily, you would

Re: [Libevent-users] Forked processes and signals

2011-03-07 Thread Nick Mathewson
On Sun, Mar 6, 2011 at 2:43 PM, Nick Mathewson wrote: > On Sat, Mar 5, 2011 at 4:59 AM, Christophe Fillot wrote: > [...] >> I guess this behavior is related to the epoll mechanism. >> > > Hi, Christophe!  I just tried your code and found out that the bug > does not appear on OSX 10.5 at all, but

Re: [Libevent-users] Forked processes and signals

2011-03-06 Thread Nick Mathewson
On Sat, Mar 5, 2011 at 4:59 AM, Christophe Fillot wrote: [...] > I guess this behavior is related to the epoll mechanism. > Hi, Christophe! I just tried your code and found out that the bug does not appear on OSX 10.5 at all, but does appear on Linux whether it's using the epoll mechanism or not

Re: [Libevent-users] Forked processes and signals

2011-03-05 Thread Christophe Fillot
Nick Mathewson wrote: Hello Nick, In theory, this approach is supposed to work: what problems are you seeing in the master process? (event_base_free sounds like what you want if you do not want to use the original event_base in the subprocess. ) If I understand right, you start with a master

Re: [Libevent-users] Forked processes and signals

2011-03-04 Thread Nick Mathewson
On Fri, Mar 4, 2011 at 5:51 AM, Christophe Fillot wrote: [...] > I tried to use event_reinit() and/or event_base_free() on the master ev_base > in the child processes but this seems to break the loop in the master > process. In theory, this approach is supposed to work: what problems are you see

[Libevent-users] Forked processes and signals

2011-03-04 Thread Christophe Fillot
Hello all, I've a master process which defines an event base, and adds some events to it to handle signals (sigterm, sighup, ...) This master process creates child processes with fork(), and these processes also define an event base with signals (they do different things compared to the master