Matt Paindavoine. wrote:
Hello,
I have been using the spirit parser library, and other boost pieces (date, test, variant, ...), along with Mozilla. I recently merged in some parts of the application that were running separately, and the program started hanging. I did a bit of searching, but couldn't find anything significantly wrong, especially since the individual parts are working correctly. The problem seems to be related to threads, as the stack indicates (cf stack at the end), and as the strace output shows here:
[...]
futex(0x4045b860, FUTEX_WAIT, 2, NULL) = -1 EAGAIN (Resource temporarily [...]
#6 0x409c91fc in ~lightweight_mutex (this=0x819eb40) at lwm_pthreads.hpp:53 #7 0x409c9d24 in ~sp_counted_base_impl (this=0x819eb40) at nsCXExpRecord.cpp:219 #8 0x409c96e2 in boost::detail::sp_counted_base::destruct (this=0x819eb40) at shared_count.hpp:115 #9 0x409b2a7e in boost::detail::sp_counted_base::weak_release (this=0x819eb40) at shared_count.hpp:173
This can happen if some parts of your multithreaded program were compiled without multithreading support (or vice versa). The pthread_mutex_destroy call in ~lightweight_mutex expects to find a pthread_mutex at &m_, but the shared_ptr was created by unthreaded code, and an empty lightweight_mutex got used.