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

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



On Sun, Jun 15, 2014 at 04:28:39PM +0200, Robin wrote:
> 
> Am 15.06.2014 15:46, schrieb Azat Khuzhin:
> >On Sun, Jun 15, 2014 at 03:09:59PM +0200, Robin wrote:
> >>Hey,
> >>
> >>I was just debugging some crashes and memory leaks with valgrind and this
> >>came up:
> >>[warn] Epoll MOD(4) on fd 61 failed.  Old events were 6; read change was 2
> >>(del); write change was 0 (none): Bad file descriptor
> >Hi,
> >
> >I don't see any reason why epoll_ctl() can fail under valgrind only, so
> >seems that this is *not* false-positive.
> >You could try to use $(valgrind --db-attach=yes) to investigate this.
> Whoops, the [warn] Epoll message wasnt mean to be there, was talking about
> the Invalid write.
> >Do you have one event-base per thread?
> I only have one event-base and the application is single threaded
> >>Is this just a false positive or am I doing something wrong?
> >>This doesn't happen every time there's a new connection, in fact, it only
> >>seems to happen once
> >>
> >>I am running on Debian Wheezy & libevent 2.0.19
> >Could you try with the latest libevent version?
> >(But I don't see any patches that can fix it in history)
> I've just tried it with 2.0.21 (or were you talking about 2.1.x?) and it's
> still happening.

Yeah, I'm talking about 2.1.x (even better, clone git repository and
compile it by yourself.)

> >==14175== Invalid write of size 4
> >==14175==    at 0x5348E76: evmap_io_add (evmap.c:328)
> >==14175==    by 0x5337ACA: event_add (event.c:2073)
> >==14175==    by 0x5343927: _bufferevent_add_event (bufferevent.c:858)
> >==14175==    by 0x53440AC: be_socket_enable (bufferevent_sock.c:554)
> >==14175==    by 0x5343345: bufferevent_enable (bufferevent.c:422)
> >==14175==    by 0x806974F: net::Socket::Setup(int, sockaddr_in)
> >(Socket.cpp:77)
> >==14175==    by 0x8068A96: net::Listener<net::socket::Client>::Accept(int,
> >sockaddr_in*) (Listener.hpp:85)
> >==14175==    by 0x806885A:
> >net::Listener<net::socket::Client>::SOnAccept(evconnlistener*, int,
> >sockaddr*, int, void*) (Listener.hpp:112)
> >==14175==    by 0x5346161: listener_read_cb (listener.c:417)
> >==14175==    by 0xF11D8657: ???
> Although it might be my code doing some bad stuff, writing to memory it
> shouldnt - still gotta figure that out.

AFAIR I don't have such warnings under valgrind, and I'v just do simple
check on some of servers that use event listeners and bufferevent's and
there is no warnings related to libevent
(But I use upstream libevent, and there are some patches ahead, but
those are for signal layer, so it mustn't impact)

> It's still odd it only happens once though.
> 
> >>I am also getting a bunch of these type errors:
> >>>[warn] Epoll MOD(4) on fd 68 failed.  Old events were 6; read change was 2
> >>>(del); write change was 0 (none): Bad file descriptor
> >>Usually after it hit a breakpoint or it couldn't keep up (running this in a
> >>single thread+valgrind, stuff gets sloow)
> >>Am I right to assume I can just ignore it as it only seems to happen when
> >>running valgrind?
> >>
> >>
> >>- imer
> >>***********************************************************************
> >>To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> >>unsubscribe libevent-users    in the body.
> 
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users    in the body.

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