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

[Libevent-users] Segfault under specific conditions



I wrote a comet long polling server using libevent 2 (now built using the most recent libevent-2-alpha version) and I've had this problem for a while. My server segfaults/crashes/etc under high load. It's fairly simple and nothing is intrusive. The following is the most recent crash report from earlier today:

Program received signal SIGSEGV, Segmentation fault.
0xb7f6c1f6 in evhttp_add_header_internal (headers=0xfffffc40, key=0xb7f7fc45 "Connection", value=0xb7f7fc50 "close") at http.c:1467
1467            TAILQ_INSERT_TAIL(headers, header, next);
Current language:  auto; currently c
(gdb) bt
#0  0xb7f6c1f6 in evhttp_add_header_internal (headers=0xfffffc40, key=0xb7f7fc45 "Connection", value=0xb7f7fc50 "close") at http.c:1467
#1  0xb7f6f4a7 in evhttp_send_error (req=0xb7e3af50, error=504, reason=0x813d24b "Update the state. Hit PHP!") at http.c:2050
#2  0x08118f3f in hit_PHP (it={_M_node = 0x8bfdc18}) at eve.new.cpp:372
#3  0x08119b08 in long_polling_bead (it={_M_node = 0x8bfdc18}) at eve.new.cpp:468
#4  0x08119c85 in handle_beads () at eve.new.cpp:485
#5  0x08119cd6 in iterate_cb (fd=-1, event=1, arg=0x0) at eve.new.cpp:490
#6  0xb7f5a4f9 in event_base_loop (base=0x8bed9c0, flags=0) at event.c:1170
#7  0xb7f5b095 in event_base_dispatch (event_base=0x8bed9c0) at event.c:1250
#8  0x08118c93 in main (argc=1, argv=0xbfab6c34) at eve.new.cpp:631
(gdb) quit

However, here are some older crash reports (from previous versions of libevent-2). I keep these saved for reference sake.

#0  0xb7c739b4 in free () from /lib/libc.so.6
#1  0xb7f44b18 in mm_free (ptr=0x1) at event.c:2065
#2  0xb7f579b6 in evhttp_response_code (req=0xfffffff9, code=503, reason=0x813d2c8 "ERROR") at http.c:2124
#3  0xb7f5cd23 in evhttp_send_reply (req=0x98f9ba0, code=503, reason=0x813d2c8 "ERROR", databuf=0x991efb0) at http.c:2053
#4  0x0811911b in long_polling_bead (it={_M_node = 0xb7d4d170}) at eve.new.cpp:386
#5  0x08119cb1 in handle_beads () at eve.new.cpp:477
#6  0x08119d02 in iterate_cb (fd=-1, event=1, arg=0x0) at eve.new.cpp:482
#7  0xb7f47f18 in event_base_loop (base=0x98ce9c0, flags=0) at event.c:925
#8  0xb7f48c85 in event_base_dispatch (event_base=0x98ce9c0) at event.c:1005
#9  0x08118cbf in main (argc=1, argv=0xbf84b514) at eve.new.cpp:622


#0  0xb7fdb7f2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0xb7c93df0 in raise () from /lib/libc.so.6
#2  0xb7c95701 in abort () from /lib/libc.so.6
#3  0xb7fb5447 in event_exit (errcode=0) at log.c:77
#4  0xb7fb5476 in event_errx (eval=-559030611, fmt=0xb7fcb170 "%s:%d: Assertion %s failed in %s") at log.c:134
#5  0xb7fbddbc in evhttp_send_reply (req=0x9e4f5a0, code=503, reason=0x813d2c8 "ERROR", databuf=0x9e04648) at http.c:2037
#6  0x0811911b in long_polling_bead (it={_M_node = 0xb7dae170}) at eve.new.cpp:386
#7  0x08119cb1 in handle_beads () at eve.new.cpp:477
#8  0x08119d02 in iterate_cb (fd=-1, event=1, arg=0x0) at eve.new.cpp:482
#9  0xb7fa8f18 in event_base_loop (base=0x9dec9c0, flags=0) at event.c:925
#10 0xb7fa9c85 in event_base_dispatch (event_base=0x9dec9c0) at event.c:1005
#11 0x08118cbf in main (argc=1, argv=0xbfd8d4b4) at eve.new.cpp:622

#0  0xb7fd47f2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0xb7a44df0 in raise () from /lib/libc.so.6
#2  0xb7a46701 in abort () from /lib/libc.so.6
#3  0xb7a7d28b in __libc_message () from /lib/libc.so.6
#4  0xb7a85595 in _int_free () from /lib/libc.so.6
#5  0xb7a859d9 in free () from /lib/libc.so.6
#6  0xb7f9eb18 in mm_free (ptr=0x6) at event.c:2065
#7  0xb7fb19b6 in evhttp_response_code (req=0x9621c58, code=503, reason=0x813d308 "ERROR") at http.c:2124
#8  0xb7fb6d23 in evhttp_send_reply (req=0xb7b5f178, code=503, reason=0x813d308 "ERROR", databuf=0x96239f0) at http.c:2053
#9  0x0811915f in long_polling_bead (it={_M_node = 0xb7b5f170}) at eve.new.cpp:386
#10 0x08119cf5 in handle_beads () at eve.new.cpp:477
#11 0x08119d46 in iterate_cb (fd=-1, event=1, arg=0x0) at eve.new.cpp:482
#12 0xb7fa1f18 in event_base_loop (base=0x95d5890, flags=0) at event.c:925
#13 0xb7fa2c85 in event_base_dispatch (event_base=0x95d5890) at event.c:1005
#14 0x08118d03 in main (argc=1, argv=0xbfa17104) at eve.new.cpp:623

#0  0xb79bb9b4 in free () from /lib/libc.so.6
#1  0xb7ed4b18 in mm_free (ptr=0x69) at event.c:2065
#2  0xb7ee79b6 in evhttp_response_code (req=0x61, code=503, reason=0x813d308 "ERROR") at http.c:2124
#3  0xb7eecd23 in evhttp_send_reply (req=0x9be41c0, code=503, reason=0x813d308 "ERROR", databuf=0x9b96088) at http.c:2053
#4  0x0811915f in long_polling_bead (it={_M_node = 0xb7a95170}) at eve.new.cpp:386
#5  0x08119cf5 in handle_beads () at eve.new.cpp:477
#6  0x08119d46 in iterate_cb (fd=-1, event=1, arg=0x0) at eve.new.cpp:482
#7  0xb7ed7f18 in event_base_loop (base=0x9b90890, flags=0) at event.c:925
#8  0xb7ed8c85 in event_base_dispatch (event_base=0x9b90890) at event.c:1005
#9  0x08118d03 in main (argc=1, argv=0xbf85d224) at eve.new.cpp:623