Hi Nick, Thanks for the reply.
Since you are unaware of such a case and it's supposed to work. Then I'm starting to think it's a bug in my code ("double delete" ==> reference count getting decremented prematurely - which Valgrind will not be able to catch). The software I'm writing is for production. Therefore stability is very important to me. How stable is the Alpha. In your opinion should I stay with 2.0.21 or move to the Alpha? Thanks, Tomer. ________________________________________ From: owner-libevent-us...@freehaven.net <owner-libevent-us...@freehaven.net> on behalf of Nick Mathewson <ni...@freehaven.net> Sent: Tuesday, July 30, 2013 6:06 PM To: libevent-users@freehaven.net Subject: 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 <to...@skyfence.com> 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 majord...@freehaven.net with unsubscribe libevent-users in the body.*********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.