Comment 6 for bug 1427981

Revision history for this message
Jan-Benedict Glaw (jbglaw) wrote :

I saw ESRCH problems on one of our applications, which unfortunately leads to aborts() from within libmicrohttpd under certain circumstances.

Looking at your sample code, I guess that its main problem is the way you're receiving the thread return value off pthread_join(). Look carefully at it, you're getting a void * assigned to an integer (submitted through the void ** supplied to pthread_join())! So that int shall hold all of a pointer, which formally won't work, and may or may not work, depending on whether or not you're on a 32 bit architecture. You are, however, on a amd64 host, so the program isn't correct here. -f{no-,}stack-protector may change the stack layout, that's why you're seeing differences in testcase execution.

That said, on success, your index variable (i) is overwritten by the NULL pointer received from the thread function on success. That's why you always start with i=0 after a successful pthread_join().

That, unfortunately, invalidates the test case, and I need to continue to find the root cause of my very own problem. ;-)