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

[Libevent-users] bufferevent_free() not safe within event callback in 2.0.2?



In the event handler, if I'm seeing a BUF_EVENT_TIMEOUT and I do a bufferevent_free() at that point, everything is fine. But if during the same handler I try to do a bufferevent_free() for a BEV_EVENT_EOF then I see this:

[err] bufferevent.c:611: Assertion bufev_private->refcnt > 0 failed in _bufferevent_decref_and_unlock

Program received signal SIGABRT, Aborted.
0x00007ffff7614067 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.

The example in the documentation here:

http://www.wangafu.net/~nickm/libevent-book/Ref6_bufferevent.html

says that doing a bufferevent_free() during a BEV_EVENT_EOF is safe, but that's not what I'm seeing. Same thing happens if it's during a BEV_EVENT_ERROR, by the way.

My bufferevent was created with BEV_OPT_CLOSE_ON_FREE but I don't think that would make a difference.

Again, this is 2.0.2 so maybe the behavior changed in 2.1.1 for which I'm looking at documentation and examples.

The only bug I found in the changelog which might have anything to do with this is in 2.0.3:

o Detect errors during bufferevent_connect(). Patch from Christopher Davis.

but it's not clear that's what I'm seeing... This was created as a bufferevent_socket_new().

And the EOF happens after the connect() succeeds, obviously. The ERROR happens on an unconnected socket...

Anyone have an idea what I'm seeing?

Thanks,

-Philip

***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.