Package: libc6 Version: 2.3.2.ds1-13 Severity: normal pthread_cond_timedwait with a timespec in the past sometimes destroys the pthread_cond_t variable. The following pthread_cond_(timed)wait calls ignore all signals on the condition variable and block.
There is no Workaround, because I cannot guarantee that the timespec is really in the future (because the thread may be interrupted between gettimeofday and pthread_cond_timedwait). The problem only occurs with NPTL (i.e. I can't reproduce the problem with LD_ASSUME_KERNEL=2.4.19). The following program deadlocks after some iterations (10-1000). *** /tmp/current/bug.c // gcc -pthread -Wall -O2 -std=c99 bug.c -o bug #include <stdio.h> #include <pthread.h> pthread_mutex_t mutex; pthread_cond_t empty; pthread_cond_t nonempty; unsigned count = 0; void* run(void* env) { pthread_mutex_lock(&mutex); struct timespec ts = { 0, 0 }; for (;;) { count = 0; pthread_cond_signal(&empty); pthread_cond_timedwait(&nonempty, &mutex, &ts); count = 0; pthread_cond_signal(&empty); pthread_cond_wait(&nonempty, &mutex); } } int main() { pthread_mutex_init(&mutex, 0); pthread_cond_init(&empty, 0); pthread_cond_init(&nonempty, 0); pthread_t thread; pthread_create(&thread, 0, &run, 0); pthread_mutex_lock(&mutex); for (unsigned i = 0;; ++i) { while (count > 0) { pthread_cond_wait(&empty, &mutex); } ++count; pthread_cond_signal(&nonempty); printf("%u\n", i); } } -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.7-1-686-smp Locale: LANG=C, [EMAIL PROTECTED] Versions of packages libc6 depends on: ii libdb1-compat 2.1.3-7 The Berkeley database routines [gl -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]