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] Re: RPC: patch for evrpc_free() and evrpc_unregister_rpc()

2011-03-08 Thread Christophe Fillot
Nick Mathewson wrote: Hi Nick, When I apply this patch, the unit tests don't pass any more. I get: rpc/basic_test: [forking] OK rpc/basic_message: [forking] OK rpc/basic_client: [forking] [err] evrpc.c:109: Assertion r == 0 failed in evrpc_free [Lost connection!] [basic_client FAILED] rpc/

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

[Libevent-users] Re: RPC: patch for evrpc_free() and evrpc_unregister_rpc()

2011-03-04 Thread Christophe Fillot
It seems that the patch was corrupted in my previous email, here the correct version. Sorry for the inconvenience. Christophe Hello all, The following patch fixes incorrect assertions in evrpc_free(): evrpc_unregister_rpc() and evrpc_remove_hook() return 0 for success. Also, in evrpc_unregis

[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

[Libevent-users] RPC: patch for evrpc_free() and evrpc_unregister_rpc()

2011-02-28 Thread Christophe Fillot
Hello all, The following patch fixes incorrect assertions in evrpc_free(): evrpc_unregister_rpc() and evrpc_remove_hook() return 0 for success. Also, in evrpc_unregister_rpc(), it is better to free RPC structure at the end: evrpc_free() uses rpc->uri as "name" parameter when calling evrpc_unregi

Re: [Libevent-users] RPC: patch for cancelling requests

2011-02-26 Thread Christophe Fillot
Nick Mathewson wrote: Hello Nick, It looks plausible, though I haven't had a chance to review it too closely yet. I would like to have unit tests for this particular case too, if at all possible. No problem, I'll try to make some examples soon. One thing to watch out for in this code is th

[Libevent-users] RPC: patch for cancelling requests

2011-02-25 Thread Christophe Fillot
Hello, The following patch allows to delete a RPC pool (with evrpc_pool_free()), including all requests which have already started. The user-defined callback is called with a new status (EVRPC_STATUS_ERR_ABORTED) which allows to properly release memory used for message requests and replies.

Re: [Libevent-users] RPC: Problem with hooks and evrpc_reply_done_closure ?

2011-02-25 Thread Christophe Fillot
Christophe Fillot wrote: [...] However, in case of error, evhttp_connection_fail() is called, and frees the HTTP request without checking the owner flag. In fact, in this case, this is evhttp_connection_cb_cleanup() which frees the HTTP request, and not evhttp_connection_fail(). Christophe

[Libevent-users] RPC: Problem with hooks and evrpc_reply_done_closure ?

2011-02-24 Thread Christophe Fillot
Hello all, I'm using libevent-2.0.10, and I think I discovered a problem when the following conditions are met: - A hook returning EVRPC_PAUSE is set in the input direction ; - The RPC fails due to an HTTP problem ("connection refused" for example) In evrpc.c, evrpc_reply_done() is set as a cal