Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001115 [1003.1(2016)/Issue7+TC2] System Interfaces Editorial Clarification Requested 2017-01-13 14:41 2017-01-13 15:03
Reporter Florian Weimer View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Florian Weimer
Organization Red Hat
User Reference
Section pthread_mutex_lock
Page Number unknown
Line Number unknown
Interp Status ---
Final Accepted Text
Summary 0001115: Lock acquisition state after pthread_mutex_lock with EOWNERDEAD
Description The text currently says:


If mutex is a robust mutex and the owning thread terminated while holding the mutex lock, a call to pthread_mutex_lock() may return the error value [EOWNERDEAD] even if the process in which the owning thread resides has not terminated. In these cases, the mutex is locked by the thread but the state it protects is marked as inconsistent.


It is unclear to which thread “the thread” in the last sentence refers.

The current text goes on with:


The application should ensure that the state is made consistent for reuse and when that is complete call pthread_mutex_consistent(). If the application is unable to recover the state, it should unlock the mutex without a prior call to pthread_mutex_consistent(), after which the mutex is marked permanently unusable.


Due to the ambiguity above, it is unclear whether the current thread (which calls pthread_mutex_consistent()) has acquired the lock after the call, and whether it is correct to call pthread_mutex_unlock() afterwards.
Desired Action I suggest to replace “the thread” with “the thread which has called pthread_mutex_lock() resulting in an [EOWNERDEAD] error”.

As a result, the mutex is in the acquired state, and it remains so after a call pthread_mutex_consistent(). Then it's allowed to call pthread_mutex_unlock() whether or not pthread_mutex_consistent() has been called.

Another implication is that because the new thread acquires the lock, only one thread can return [EOWNERDEAD], and the others will block. I do not know if this matches actual implementation practice, but it is the only way robust mutexes can recovery without external synchronization.
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0003542)
geoffclare (manager)
2017-01-13 15:03

I have no objection to improving the text here, but the localised ambiguity disappears when reading the DESCRIPTION section as a whole, because the first sentence clearly states "The mutex object referenced by mutex shall be locked by a call to pthread_mutex_lock() that returns zero or [EOWNERDEAD]."

- Issue History
Date Modified Username Field Change
2017-01-13 14:41 Florian Weimer New Issue
2017-01-13 14:41 Florian Weimer Name => Florian Weimer
2017-01-13 14:41 Florian Weimer Organization => Red Hat
2017-01-13 14:41 Florian Weimer Section => pthread_mutex_lock
2017-01-13 14:41 Florian Weimer Page Number => unknown
2017-01-13 14:41 Florian Weimer Line Number => unknown
2017-01-13 14:45 Florian Weimer Issue Monitored: Florian Weimer
2017-01-13 15:03 geoffclare Note Added: 0003542


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker