hi, when i use libevent, the libevent thread locked, so the program wait.
the info:
in the evthread_win32_lock() fun, the thread lock in the EnterCriticalSection()
you can see the pictures for more info!
I guess it is a stack overflow problem, bucause in the function of evthread_win32_lock(), the argv :
lock_ = 0x0221e7a0,
CRITICAL_SECTION *lock = lock_.
but when it step to "EnterCriticalSection(lock)", the pointer lock=0xcccccccc , it's a wrong pointer.
(gdb) bt
0 0x00000034e720e054 in __lll_lock_wait () from /lib64/libpthread.so.0
1 0x00000034e72093a3 in _L_lock_892 () from /lib64/libpthread.so.0
2 0x00000034e7209287 in pthread_mutex_lock () from /lib64/libpthread.so.0
3 0x00007f80b0e10d1c in evthread_posix_lock (mode=0, lock_=0x1ce0660) at evthread_pthread.c:75
4 0x00007f80b0be2c1c in evbuffer_add (buf=0x1cedd70, data_in=0x7f80a0003038, datlen=206) at buffer.c:1710
10 0x00007f80b1a7c148 in msg_process_cb (socket=-1, event=2, arg=0x1ce1450) at libe_socket.c:571
11 0x00007f80b0bf199a in event_persist_closure (base=0x1cc8010, ev=0x1ceda50) at event.c:1446
12 0x00007f80b0bf1bdf in event_process_active_single_queue (base=0x1cc8010, activeq=0x1cc8440, max_to_process=2147483647, endtime=0x0) at event.c:1502
13 0x00007f80b0bf2168 in event_process_active (base=0x1cc8010) at event.c:1590
14 0x00007f80b0bf28cc in event_base_loop (base=0x1cc8010, flags=4) at event.c:1813
15 0x00007f80b1a79aa4 in base_work_rounte (thread=0x1cc5238, arg=0x1cc8010) at libe_ctx.c:203
16 0x00007f80b2dbfc5b in dummy_worker (opaque=0x1cc5238) at threadproc/unix/thread.c:142
17 0x00000034e7207851 in start_thread () from /lib64/libpthread.so.0
18 0x00000034e66e890d in clone () from /lib64/libc.so.6
(gdb) p *buf
$4 = {first = 0x0, last = 0x0, last_with_datap = 0x1cedd70, total_len = 0, n_add_for_cb = 0, n_del_for_cb = 0, lock = 0x1ce0660, own_lock = 0,
freeze_start = 1, freeze_end = 0, deferred_cbs = 0, flags = 1, cb_queue = 0x0, refcnt = 1, deferred = {evcb_active_next = {tqe_next = 0x0, tqe_prev = 0x0},
evcb_flags = 0, evcb_pri = 0 '\000', evcb_closure = 0 '\000', evcb_cb_union = {evcb_callback = 0, evcb_selfcb = 0, evcb_evfinalize = 0,
evcb_cbfinalize = 0}, evcb_arg = 0x0}, callbacks = {lh_first = 0x1ce06f0}, parent = 0x1cedae0}
(gdb) frame 3
3 0x00007f80b0e10d1c in evthread_posix_lock (mode=0, lock_=0x1ce0660) at evthread_pthread.c:75
75 return pthread_mutex_lock(lock);
(gdb) p *lock
$5 = {data = {lock = 2, count = 1, owner = 32460, nusers = 1, kind = 1, spins = 0, list = {prev = 0x0, next = 0x0}},
size = "\002\000\000\000\001\000\000\000\314~\000\000\001\000\000\000\001", '\000' <repeats 22="" times="">, align = 4294967298}
(gdb) frame 2
2 0x00000034e7209287 in pthread_mutex_lock () from /lib64/libpthread.so.0
(gdb) list
70 {
71 pthread_mutex_t lock = lock_;
72 if (mode & EVTHREAD_TRY)
73 return pthread_mutex_trylock(lock);
74 else
75 return pthread_mutex_lock(lock);
76 }
77
78 static int
79 evthread_posix_unlock(unsigned mode, void lock_)
(gdb) p *lock
Cannot access memory at address 0x0
(gdb) p lock
$6 = 0
(gdb)
Last edit: zzhongcy 2014-05-12
i find that it's not libevent bug, there is something wrong with my project. sorry...