I'm using the 2.0.2 version, and trying out the evlistener stuff.

Occassionally, I am getting a strange segfault.

Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1210161472 (LWP 31491)]
> 0xb7f8d79a in _dl_rtld_di_serinfo () from /lib/ld-linux.so.2
> (gdb) bt
> #0  0xb7f8d79a in _dl_rtld_di_serinfo () from /lib/ld-linux.so.2
> #1  0xb7f8db07 in _dl_rtld_di_serinfo () from /lib/ld-linux.so.2
> #2  0xb7f912f9 in _dl_rtld_di_serinfo () from /lib/ld-linux.so.2
> #3  0xb7f91090 in _dl_rtld_di_serinfo () from /lib/ld-linux.so.2
> #4  0xb7f67759 in listener_read_cb (fd=12, what=2, p=0xb7d59fb0) at
> listener.c:165
> #5  0xb7f5ee10 in event_base_loop (base=0xb7d13ddc, flags=<value optimized
> out>) at event.c:665
> #6  0x0804b59e in main ()

It is faulting in the libevent code, right on the accept() line.

I've not ruled out something funky on my system, because the application
also fails occassionally in another spot on a send().
I have other applications which do not use the evconnlistener stuff, and do
not cause any segfaults (in accept or in send),

Yesterday, I was making some code changes in a completely different part of
the code (parsing the data received), and didn't have any issues.  Today I
re-compiled it without even making any additional changes, and it started
segfaulting rather consistently.

I've had this problem a few times in the last month, but hadn't mentioned it
because I wasn't sure where the problem actually was (why does it always
segfault in actual socket functions?), and that the problem seemed to
magically go away by the next day.

I'm still investigating, but thought I would put this info out there in case
anyone else is seeing it too.

The only real thing different about today and yesterday.  Yesterday I
started my laptop at home, with the wireless network automatically on.  No
problems.   Today I started the laptop on the train and turned wireless
off.  Then I suspended the laptop.  When I got home, I opened it up and
resumed, and then turned the wireless connection back on.   Usual surfing of
the internet worked fine, and a few hours later re-compiled the code I was
playing with yesterday and the first time it ran, got that a seg-fault.   So
its possible my system behaves differently after a suspend/resume, or even a
wireless off/on....  I'll investigate that further.

Here is the code I use to initialize the listener:
The interface string passed in was ""

static void server_listen(server_t *server, char *interface)
        *struct* sockaddr_in sin;

        int len;

        memset(&sin, 0, *sizeof*(sin));
        sin.sin_family = AF_INET;

        len = *sizeof*(sin);

        *if* (evutil_parse_sockaddr_port(interface, (*struct* sockaddr
*)&sin, &len) != 0) {

        *else* {

                assert(server->listener == NULL);

                server->listener = evconnlistener_new_bind(

                        (*struct* sockaddr*)&sin, *sizeof*(sin));


Sorry for the long-winded email...  just wanted to get all the information
out in one go.

"Be excellent to each other"
Libevent-users mailing list

Reply via email to