On Tue, Feb 9, 2010 at 3:31 AM, Jj Jack <[email protected]> wrote: > Hello, > > I seem to have run against another strange problem, to me, atleast. I'm using > bufferevents and the evconnlistener interface to set up a new listener on a > base, setting up some options on the base, and dispatching it. I'm then > stress testing this program, at which point the base exits causing everything > to fail. The return code is 1. Does anyone have any idea as to why this might > be happening? >
Unfortunately, the situation you describe is complicated enough that I can't figure out how to debug it based only on the information you've given. There could be a bug in your code, or a bug in Libevent. Certainly, evconnlisteners aren't supposed to just die, and the event_base_loop() isn't _supposed_ to exit like you're seeing, but without more specific code I've got no way of telling why. (I assume you're trying this on Libevent 2.0.3-alpha, btw. Earlier versions had big threading bugs. There were also a few minor threading bugs in Libevent 2.0.3-alpha, of course; have you tried reproducing using the latest development code from the Git repository? [1] I believe it fixed a bug specifically related to the 1-return case from event_base_loop() back in commit da1718b2. [2]) What would really help here would be if you could somehow write a small test program that shows the behavior you're seeing. [...] > I don't quite get the use of locks on the event loop, as that's most likely > only going to run on one thread? The issue is that while you're running the event loop from one thread, you might need to access it from another thread. For example, if you add, delete, or activates events in the event loop from another thread, the event base needs to have locking enabled, or else you'll have race conditions when other threads try to access it. (This can happen indirectly if you're using stuff like evconnlistener or bufferevents, which work internally by adding and deleting events of their own.) Of course, if there's only one thread in your program, you don't need to have locking enabled at all. [1] git://levent.git.sourceforge.net/gitroot/levent/libevent [2] This probably means that it's past time for a new alpha release. hope this helps, -- Nick *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
