Re: [Libevent-users] files and libevent

2008-06-14 Thread Nick Mathewson
On Thu, Jun 12, 2008 at 07:59:45AM -0700, Teunis Peters wrote:
 I've not found any code to work with - but is there any reason that 
 libevent would not work with standard files?
 
 I keep getting permission denied
 
 more or less:
 
 fd = open(filename, O_RDONLY)
 event_set(ev, EV_READ | EV_PERSIST, rd_callback, rd_data);
 event_add(ev, NULL)
 - EPERM
 
 Or does libevent only work with network connections?

Libevent uses underlying nonblocking IO mechanisms the platform gives
it.  Some of these work well with non-socket file descriptors; some
don't.  By default, libevent uses the fastest (best-scaling) backend
that it knows about for your platform, even if that backend doesn't
support all fds.

In the current svn trunk (which will eventually become libevent 2.0),
there's a feature to let you specify that you want a backend that
works with file descriptors, even if it doesn't scale well.

yrs,
-- 
Nick
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users


Re: [Libevent-users] [err] event_queue_insert: 0xb6a4517c(fd 17) already on queue 2

2008-06-14 Thread Nick Mathewson
On Fri, Jun 13, 2008 at 10:01:33AM +0200, Ron Arts wrote:
 Hello,
 
 I get this error on libevent 1.3e on CentOS5. Upgrading to
 a higher version is not easy to push through, to say the least,
 so that's why I am asking the list first.

The error message looks like an event that's already been added to a
queue is getting added again, and that's not supposed to happen.
queue 2 is EVLIST_INSERTED, the list of all events that have been
event_add()ed for IO events and not event_del()d.

The double insert is pretty weird, though, since event_add() is pretty
good about not adding an event that's already been added.  The code
where it puts an event into the EVLIST_INSERTED queue is (in 1.3-svn):

if ((ev-ev_events  (EV_READ|EV_WRITE)) 
!(ev-ev_flags  (EVLIST_INSERTED|EVLIST_ACTIVE))) {
event_queue_insert(base, ev, EVLIST_INSERTED);

return (evsel-add(evbase, ev));
}

so unless I can't read C this morning, it should only add the event to
the queue if it's already not-inserted and not-active.

In other words, something fishy is afoot here.  Having a stack trace
and the contents of the offending struct event might help track it down.

yrs,
-- 
Nick

___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users


Re: [Libevent-users] [err] event_queue_insert: 0xb6a4517c(fd 17) already on queue 2

2008-06-14 Thread Niels Provos
On Sat, Jun 14, 2008 at 11:13 AM, Nick Mathewson [EMAIL PROTECTED] wrote:
 In other words, something fishy is afoot here.  Having a stack trace
 and the contents of the offending struct event might help track it down.

To me this seems like some kind of memory corruption might be
happening; such as accessing an event that was freed or creating an
event on the stack that becomes invalid when the function returns.

Niels.
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users