Bug 58744 - pthread mutex warning is outdated
Summary: pthread mutex warning is outdated
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: HTTP Server Documentation List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-17 03:09 UTC by Daniel Axtens
Modified: 2016-01-12 16:14 UTC (History)
1 user (show)



Attachments
Added Linux as platform that supports strong pthread mutex (730 bytes, patch)
2015-12-28 14:23 UTC, Luca Toscano
Details | Diff
Added Linux as platform that supports strong pthread mutex + POSIX (951 bytes, patch)
2016-01-07 16:18 UTC, Luca Toscano
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Axtens 2015-12-17 03:09:15 UTC
In documentation for the core module (manual/mod/core.xml), there's a very prominent warning about the safety of pthread mutexes:

"On most systems, if a child process terminates abnormally while holding a mutex that uses this implementation, the server will deadlock and stop responding to requests. When this occurs, the server will require a manual restart to recover.
Solaris is a notable exception as it provides a mechanism which usually allows the mutex to be recovered after a child process terminates abnormally while holding a mutex.
If your system implements the pthread_mutexattr_setrobust_np() function, you may be able to use the pthread option safely."

Linux has supported robust pthread mutexes for quite some time: Documentation/robust-futexes.txt went into the kernel in 2006, and man pages for pthread_mutexattr_setrobust_np were added in ~2008.

There may well be systems that still don't support it, so the warning should probably still stay, but could you please add Linux to the list of systems where it's safe?
Comment 1 Luca Toscano 2015-12-28 14:23:14 UTC
Created attachment 33381 [details]
Added Linux as platform that supports strong pthread mutex
Comment 2 Luca Toscano 2015-12-28 14:24:19 UTC
Hi Daniel,

I checked your statement and added a patch for the documentation, let me know if you want me to add more info. I don't have commit permissions so we'll need to wait for somebody to pick this bug up :)

Luca
Comment 3 Daniel Axtens 2016-01-04 23:57:53 UTC
Hi Luca,

Thanks for the patch!

I've done some more reading, and it seems that robust mutexes were added to POSIX, in Issue 7 (released 2008).

(See http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_getrobust.html, or for a more accessible explanation, http://stackoverflow.com/questions/9804915/robust-pthread-mutexes-portability-across-platforms )

This is definitely bikeshedding, but maybe it would be worth rewording the patch to say that it's available on Solaris, Linux and any other system that supports POSIX robust mutexes?

Thanks again.
Daniel
Comment 4 Luca Toscano 2016-01-07 16:18:51 UTC
Created attachment 33422 [details]
Added Linux as platform that supports strong pthread mutex + POSIX

Hi Daniel,

do you think that the following sentence embodies your thoughts?

"If your system is POSIX compliant or if it implements the pthread_mutexattr_setrobust_np() function, you may be able to use the pthread option safely."

Added new patch just in case :)

Luca
Comment 5 Rich Bowen 2016-01-12 16:14:52 UTC
Thank you.

Applied to trunk in r1724265.
Applied to 2.4 in r1724267.