Public bug reported:
While investigating https://github.com/google/re2/issues/22, we
discovered that statically linking libpthread is problematic since
Ubuntu 14.10. I suspect that the TLS (Thread-Local Storage) is not
initialised properly, which results in hangs or crashes.
junyer@whalre
Note that the third case worked because the use of `-Wl,--whole-archive
-lpthread -Wl,--no-whole-archive' is a workaround that evidently results
in the TLS (Thread-Local Storage) being initialised properly.
The root cause of this bug is currently uncertain, but
junyer@whalre:~$ g++ -Wall -Werror foo.cc -o foo -lpthread
junyer@whalre:~$ ./foo
foo: pthread_rwlock_init(lock, NULL): 0
foo: pthread_rwlock_wrlock(lock): 0
foo: pthread_rwlock_unlock(lock): 0
foo: pthread_rwlock_wrlock(lock): 0
foo: pthread_rwlock_unlock(lock): 0
foo: pthread_rwlock_destroy
Note that the second case hung and thus required me to hit Ctrl-C.
The proximate cause seems to be that the TID (Thread ID) in the TLS
(Thread-Local Storage) is not initialised properly:
1. The first pthread_rwlock_wrlock() call sets __writer to the TID, which is 0.
2. The first
Subject: FFe: Sync rsyslog 4.6.1-1 (main) from Debian testing (main)
affects ubuntu/rsyslog
status new
importance wishlist
subscribe ubuntu-release
done
Please sync rsyslog 4.6.1-1 (main) from Debian testing (main)
Explanation of the Ubuntu delta and why it can be dropped:
Sorry, I'm