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

[Libevent-users] bufferevent_openssl_filter_new and event_base_free



Hello,

I am running into a problem where I am unable to properly free the event_base when using theÂbufferevent_openssl_filter.
I have a use case where I need to connect and immediately disconnect from a remote server.Â

This is the error I am seeing.

[debug] event_add: event: 0x7fd99ac1e490 (fd 6), EV_READÂ Â call 0x10811b8f0

[debug] event_callback_finalize_many_: 3 events finalizing

[debug] event_del: 0x7fd99ad00b00 (fd -1), callback 0x1081175c0

[debug] event_del: 0x7fd99ad00b80 (fd -1), callback 0x108117620

[debug] event_del: 0x7fd99ad00b00 (fd -1), callback 0x1081175c0

[debug] event_del: 0x7fd99ac1e490 (fd 6), callback 0x10811b8f0

[debug] event_del: 0x7fd99ad00b00 (fd -1), callback 0x108116c70

[debug] event_callback_finalize_many_: 3 events finalizing

[debug] event_del: 0x7fd99ac1e490 (fd 6), callback 0x10811b8f0

[debug] event_del: 0x7fd99ac1e510 (fd 6), callback 0x10811bb30

[debug] event_del: 0x7fd99ac1e490 (fd 6), callback 0x10811b8f0

[debug] event_base_free_: 1 events were still set in base

[err] event.c:840: Assertion TAILQ_EMPTY(&base->activequeues[i]) failed in event_base_free_Abort trap: 6


I attached a small test program demonstrating the problem. You will have to change the LIBEVENT_BASE_DIR variable in the included Makefile.

I am able to get around the problem by not freeing the underlying bufferevent or by using event_base_free_nofinalize but then we are leaking memory according to valgrind.

It is not clear to me that I am even setting up this stuff properly even though it is working well. Any insight would be greatly appreciated!

Thanks for your time!

Topher





Attachment: test_libevent_ssl_connect_disconnect.tar.gz
Description: GNU Zip compressed data