[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] calling bufferevent_free within it's own event (version 2.0.21).
On Mon, Jul 29, 2013 at 2:55 AM, Tomer Heber <tomer@xxxxxxxxxxxx> wrote:
> Hi,
>
>
>
> I’ve encountered a strange behavior with ssl bufferevents:
>
> 1. My program calls bufferevent_write(),
>
> 2. (Some error occurs – which is ok) bufferevent_write calls my
> event_cb.
>
> 3. My event_cb releases the bufferevent.
>
> 4. Program segfaults.
>
>
>
> I’ve worked with Valgrind and checked the libevent source code – it seems
> that after bufferevent_write is calling my event_cb (which releases the
> bufferevent) it then modifies a value in the ssl_bufferevent (which is
> already released).
>
>
>
> So what’s the deal? Is it allowed to release a bufferevent with in its own
> events? Or is it not allowed?
It's *supposed* to work. Not sure why it isn't in your case. Is
there a reference count getting decremented prematurely or something?
Have you tried the latest alpha? It refactors how bufferevent cleanup
works significantly.
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.