[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Event base exiting from loop unexpectedly.
- To: libevent-users@xxxxxxxxxxxxx
- Subject: Re: [Libevent-users] Event base exiting from loop unexpectedly.
- From: Nick Mathewson <nickm@xxxxxxxxxxxxx>
- Date: Mon, 15 Feb 2010 14:34:33 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Mon, 15 Feb 2010 14:34:42 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type:content-transfer-encoding; bh=B8kLbnrv9tufnxJBSz5KY6aASBnRAaINpb9gKFtkEQE=; b=L5GbyjgNmjEoOqKR1gFFe3JAy2BroMLU1wXlBfWtviqECLZddVAoaVoh78ljO6kl0N hMWnz0l5P9DirWvWDrUJ3kEF0YjDX6POMkixPtnhIcTHTFWOOZd04f7vlCYnaGSeolwl TCgjotDzEKGtei/Wh+E0evqH/1BZ1P9I+Ii8I=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=a5GWd80pBORqHpoaYisc1ogZzpQbpn/pkdwiNYZrxG5crsg6IDcdu6Q9nwPgcGla+I 4cFPB4vnXmvMFzi+rOAw0v+i7x/wchamwjNeNdLJs2pR9bzU5Y5zw7kGNfac3XSv1SU0 D5GK8KFtEIBxtahPnxRs2CIU/h96oMe6aWhF8=
- In-reply-to: <600339.58293.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <600339.58293.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
On Tue, Feb 9, 2010 at 3:31 AM, Jj Jack <jjjack94@xxxxxxxxx> 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 majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.