Open jbglaw opened 6 years ago
Hello,
I don't have much experience with multi-threaded applications. Please take a look at issue #11 where lots of stuff regarding this matter is discussed. I tried to summarize the caveats in the main README file (see at the bottom).
Maybe the clone()
call interferes with the C/pthread library's tracking of threads? What happens if you build with POPEN_NOSHELL_VALGRIND_DEBUG
defined? You could also modify this library to use vfork()
instead as discussed in earlier issues. Other than clone()
, I don't see what could do it -- this library is clearly thread-safe in that there is no global (nor static global) state. (Well, there is the environ
, but let's ignore that for now.)
Hi!
I don't (yet) have a lot of information about how it happens, but putting popen-noshell in a threaded application (some usual threads, as well as per-connection threads originating from libmicrohttpd), I occassionally see:
Fatal error in GNU libmicrohttpd daemon.c:2039: Failed to join a thread
followed by the libmicrohttpd exiting the application... Not yet sure if this is a libmicrohttpd bug, or an interference with pthreads itself. The above error message is printed with pthread_join() fails. (ESRCH is returned, and if I decoded the pthread_t correctly, it's ->tid field is zero.)
So this is just a heads-up, or maybe you have a hint right away. I'll add anything I find out of course.
Thanks, Jan-Benedict