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

Re: [Libevent-users] Valgrind, evmap_io_add Invalid write of size 4



Sorry for the late reponse.
I tried the latest code from github and it didnt give me the invalid write. Although I'd prefer to use the easy to install libraries from debian itself instead of having to compile them myself.
Maybe I'm just doing something wrong and it isnt a libevent glitch?

The most common way for this to happen would be if one of the events for this fd has been freed without first removing it from the event_base with event_del().
I'm calling bufferevent_free() in the destructor of my socket class - that's all I need to do or did I miss anything?
It might also happen, I think, if you
use event_assign() or event_set() to change an event's configuration
without first removing it from the event_base with event_del().
Not using any of those, so I should be good there.

This one makes a bit more sense, thats libevent memory I assume?
==3728== Invalid write of size 4
==3728== at 0x5348FE6: evmap_io_add (in /usr/lib/i386-linux-gnu/libevent-2.0.so.5.1.7) ==3728== by 0x5337BAA: event_add (in /usr/lib/i386-linux-gnu/libevent-2.0.so.5.1.7) ==3728== by 0x5343A57: _bufferevent_add_event (in /usr/lib/i386-linux-gnu/libevent-2.0.so.5.1.7) ==3728== by 0x53441DC: be_socket_enable (in /usr/lib/i386-linux-gnu/libevent-2.0.so.5.1.7) ==3728== by 0x5343475: bufferevent_enable (in /usr/lib/i386-linux-gnu/libevent-2.0.so.5.1.7) ==3728== by 0x806978F: net::Socket::Setup(int, sockaddr_in) (Socket.cpp:77) ==3728== by 0x8068AD6: net::Listener<net::socket::Client>::Accept(int, sockaddr_in*) (Listener.hpp:85) ==3728== by 0x8068871: net::Listener<net::socket::Client>::SOnAccept(evconnlistener*, int, sockaddr*, int, void*) (Listener.hpp:112) ==3728== by 0x53462E1: listener_read_cb (in /usr/lib/i386-linux-gnu/libevent-2.0.so.5.1.7)
==3728==    by 0x892CFED8: ???
==3728== Address 0x4ec8e170 is 112 bytes inside a block of size 268 free'd
==3728==    at 0x51DF50C: free (vg_replace_malloc.c:427)
==3728== by 0x53396C3: event_mm_free_ (in /usr/lib/i386-linux-gnu/libevent-2.0.so.5.1.7) ==3728== by 0x81E586F: net::socket::Generic<net::socket::Client>::~Generic() (Generic.hpp:45)
==3728==    by 0x81E45A3: net::socket::Client::~Client() (Client.cpp:47)
==3728==    by 0x81E4646: net::socket::Client::~Client() (Client.cpp:52)
==3728== by 0x806878E: net::Listener<net::socket::Client>::RemoveClosed() (Listener.hpp:68) ==3728== by 0x8068454: net::NetworkManager::Tick() (NetworkManager.cpp:89)
==3728==    by 0x81A4277: idle() (main.cpp:552)
==3728==    by 0x81A355D: main (main.cpp:299)

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