[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: slapd hangs in fputs() in signal handler (ITS#2550)



I've #if 0 them.

Kurt

At 05:42 AM 5/24/2003, h.b.furuseth@usit.uio.no wrote:
>Full_Name: Hallvard B Furuseth
>Version: HEAD
>OS: Solaris
>URL: 
>Submission from: (NULL) (129.240.186.42)
>Submitted by: hallvard
>
>
>I've just had slapd hang while it was doing fputs() from a signal handler.
>The signal handler was called during a Debug() which was waiting for a
>semaphore in fputs(), then the handler called Debug() and tried to wait
>a semaphore (presumably the same one) again.
>
>For some reason two threads showed this state, I don't know what to make
>of that.  Two other threads were waiting for a semaphore in fprintf.
>
>Fix: Either remove all output statements in signal handlers, or replace
>them with the system call write() - *on systems where we know write() is
>a system call and not a library function on top of stdio or something*.
>
>(gdb) thread 10
>[Switching to thread 10 (LWP    13        )]
>#0  0xfef9bd34 in _lwp_sema_wait () from /usr/lib/libc.so.1
>
>(gdb) bt
>#0  0xfef9bd34 in _lwp_sema_wait () from /usr/lib/libc.so.1
>#1  0xfeec9ab8 in _park () from /usr/lib/libthread.so.1
>#2  0xfeec9780 in _swtch () from /usr/lib/libthread.so.1
>#3  0xfeecb148 in _mutex_adaptive_lock () from /usr/lib/libthread.so.1
>#4  0xfeecae80 in _cmutex_lock () from /usr/lib/libthread.so.1
>#5  0xfef96080 in _rmutex_lock () from /usr/lib/libc.so.1
>#6  0xfef96254 in _flockget () from /usr/lib/libc.so.1
>#7  0xfef8ec10 in fputs () from /usr/lib/libc.so.1
>#8  0x000c5418 in lutil_debug (debug=-176165696, level=1694720, 
>    fmt=0xfefb801c "") at debug.c:321
>#9  0x00032dc8 in slap_sig_shutdown (sig=1) at daemon.c:2060
>#10 0xfeed8968 in __sendsig () from /usr/lib/libthread.so.1
>#11 0xfeece0f8 in _sigon () from /usr/lib/libthread.so.1
>#12 0xfeec8468 in pthread_cond_signal () from /usr/lib/libthread.so.1
>#13 0xfef961e0 in _rmutex_unlock () from /usr/lib/libc.so.1
>#14 0xfef8ef20 in fputs () from /usr/lib/libc.so.1
>#15 0x000c5418 in lutil_debug (debug=-176160264, level=1694720, 
>    fmt=0xfefb801c "") at debug.c:321
>#16 0x00031bc0 in slapd_daemon_task (ptr=0x3ecf5f19) at daemon.c:1383
>
>(gdb) frame 8
>#8  0x000c5418 in lutil_debug (debug=-176165696, level=1694720, 
>    fmt=0xfefb801c "") at debug.c:321
>321             fputs( buffer, stderr );
>(gdb) p buffer
>$1 = "slap_sig_shutdown: signal
>1\n\0\0\0\020Þ­¾îo\0\0\0þû\200\034õ\200\ràÿ\0\0\0\0ÿ\0\0\0\0ÿ\0\200", '\0'
><repeats 11 times>, "õ\200\017øõ\200\017àõ¡
>\0\0\0\003àõ\200\017Ôõ\200\räõ\177íxÿ\003X\224\0\0\0\0ÿ\n\005 ", '\0' <repeats
>24 times>, "õ\200\017àõ¡
>\0\0\0\003à\0\0\0\0ÿ\003TÀõ\200\017ø\0\0\0\0\0\0\0\0õ\200\017à", '\0' <repeats
>12 times>, "õ\200\017Ô\0ÿ\0\0\0\0ÿ\0ánla\0\0\0b\0\0\0l~þþÿ\201\001\001\0õ"...
>
>(gdb) frame 15
>#15 0x000c5418 in lutil_debug (debug=-176160264, level=1694720, 
>    fmt=0xfefb801c "") at debug.c:321
>321             fputs( buffer, stderr );
>(gdb) p buffer
>$2 = "daemon: select: listen=6 active_threads=1
>tvp=zero\n\0\0\0\0\b\0\025Î\230\0\0\0\006\0\0\0\004\0\025Î\220õ\200\022\b\0\003\e¸",
>'\0' <repeats 83 times>, "\004þûºù", '\0' <repeats 15 times>, "\001õ\200\017
>þû\200\034\0\0\0\0õ\200\n\e\0\0\0!\0\032Ôqõ\200\n\023\0\027²Uõ\200\016ÀþøM\0õ\200\003\0þì\232¸\0\0\0\0þïU`þï\230Ô\0ÿ\0\0\0\0ÿ\0\0\0\0\0\0\0\0\001\0\027²@õ¦ \0\0\0\0\024\0\0\0\005\0\0"...
>
>
>(gdb) thread 25
>[Switching to thread 25 (Thread 4        )]#0  0xfef9bd34 in _lwp_sema_wait ()
>   from /usr/lib/libc.so.1
>(gdb) bt
>#0  0xfef9bd34 in _lwp_sema_wait () from /usr/lib/libc.so.1
>#1  0xfeec9ab8 in _park () from /usr/lib/libthread.so.1
>#2  0xfeec9780 in _swtch () from /usr/lib/libthread.so.1
>#3  0xfeecb148 in _mutex_adaptive_lock () from /usr/lib/libthread.so.1
>#4  0xfeecae80 in _cmutex_lock () from /usr/lib/libthread.so.1
>#5  0xfef96080 in _rmutex_lock () from /usr/lib/libc.so.1
>#6  0xfef96254 in _flockget () from /usr/lib/libc.so.1
>#7  0xfef8ec10 in fputs () from /usr/lib/libc.so.1
>#8  0x000c5418 in lutil_debug (debug=-176165696, level=1694720, 
>    fmt=0xfefb801c "") at debug.c:321
>#9  0x00032dc8 in slap_sig_shutdown (sig=1) at daemon.c:2060
>#10 0xfeed8968 in __sendsig () from /usr/lib/libthread.so.1
>#11 0xfeece0f8 in _sigon () from /usr/lib/libthread.so.1
>#12 0xfeec8468 in pthread_cond_signal () from /usr/lib/libthread.so.1
>#13 0xfef961e0 in _rmutex_unlock () from /usr/lib/libc.so.1
>#14 0xfef8ef20 in fputs () from /usr/lib/libc.so.1
>#15 0x000c5418 in lutil_debug (debug=-176160264, level=1694720, 
>    fmt=0xfefb801c "") at debug.c:321
>#16 0x00031bc0 in slapd_daemon_task (ptr=0x3ecf5f19) at daemon.c:1383
>
>
>(gdb) thread 16
>[Switching to thread 16 (LWP    7        )]#0  0xfef9bd34 in _lwp_sema_wait ()
>   from /usr/lib/libc.so.1
>(gdb) bt
>#0  0xfef9bd34 in _lwp_sema_wait () from /usr/lib/libc.so.1
>#1  0xfeec9ab8 in _park () from /usr/lib/libthread.so.1
>#2  0xfeec9780 in _swtch () from /usr/lib/libthread.so.1
>#3  0xfeecb148 in _mutex_adaptive_lock () from /usr/lib/libthread.so.1
>#4  0xfeecae80 in _cmutex_lock () from /usr/lib/libthread.so.1
>#5  0xfeec83b8 in _ti_cond_wait () from /usr/lib/libthread.so.1
>#6  0xfef960bc in _rmutex_lock () from /usr/lib/libc.so.1
>#7  0xfef96254 in _flockget () from /usr/lib/libc.so.1
>#8  0xfef84948 in fprintf () from /usr/lib/libc.so.1
>#9  0x0003407c in connection_destroy (c=0xf5c4abe0) at connection.c:670
>#10 0x000344dc in connection_close (c=0xf5c4abe0) at connection.c:788
>#11 0x00035c8c in connection_resched (conn=0xf5c4abe0) at connection.c:1605
>#12 0x00034fd0 in connection_operation (ctx=0xf3801b80, arg_v=0xf2616000)
>    at connection.c:1108
>#13 0x000a3634 in ldap_int_thread_pool_wrapper (xpool=0xfdfce000)
>    at tpool.c:463
>
>
>(gdb) thread 29
>[Switching to thread 29 (Thread 8        )]#0  0xfef9bd34 in _lwp_sema_wait ()
>   from /usr/lib/libc.so.1
>(gdb) bt
>#0  0xfef9bd34 in _lwp_sema_wait () from /usr/lib/libc.so.1
>#1  0xfeec9ab8 in _park () from /usr/lib/libthread.so.1
>#2  0xfeec9780 in _swtch () from /usr/lib/libthread.so.1
>#3  0xfeecb148 in _mutex_adaptive_lock () from /usr/lib/libthread.so.1
>#4  0xfeecae80 in _cmutex_lock () from /usr/lib/libthread.so.1
>#5  0xfeec83b8 in _ti_cond_wait () from /usr/lib/libthread.so.1
>#6  0xfef960bc in _rmutex_lock () from /usr/lib/libc.so.1
>#7  0xfef96254 in _flockget () from /usr/lib/libc.so.1
>#8  0xfef84948 in fprintf () from /usr/lib/libc.so.1
>#9  0x0003407c in connection_destroy (c=0xf5c4abe0) at connection.c:670
>#10 0x000344dc in connection_close (c=0xf5c4abe0) at connection.c:788
>#11 0x00035c8c in connection_resched (conn=0xf5c4abe0) at connection.c:1605
>#12 0x00034fd0 in connection_operation (ctx=0xf3801b80, arg_v=0xf2616000)
>    at connection.c:1108
>#13 0x000a3634 in ldap_int_thread_pool_wrapper (xpool=0xfdfce000)
>    at tpool.c:463