[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Problems with deferred HTTP handlers over SSL



On Sun, Jan 15, 2012 at 09:28:23PM -0600, Hochhaus, Andrew wrote:
> I modified Amarin's test program to call evthread_use_pthreads()
> [attached]. I also added BEV_OPT_THREADSAFE to the
> bufferevent_openssl_socket_new/bufferevent_socket_new calls in
> evhtp.c.
> 
> This improves things, however, I now see that the calls to
> evhtp_send_reply in DeferredHandler do not return. Possibly internal
> deadlock?
> 
> Additionally, about 1 in 5 requests never display in the browser but
> instead wait forever (likely related to evhtp_send_reply not
> returning).
> 

After doing some thinking the other night, the problem exists because
the connection pool that evhtp provides has it's own evbase, once you
return from your called function, it goes out of scope (the evbase
you were once using is gone). This is why wait worked, but detach did
not.

If you want per-request-threading, you should probably go and implement 
your own solution around this without using the builtin connection
pooling functionality.

However, if you are having to do a per-request thread, it's completely
pointless to use a non-blocking system; a better bet is to go back and
rethink the design.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.