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

[Libevent-users] calling bufferevent_free within it's own event (version 2.0.21).



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?

 

As a workaround I should never release bufferevents within their events. Although it would be less efficient (I’ll have to execute an event to release the bufferevent).

 

Suggestions?

 

Thanks,

Tomer.