Modify

Opened 6 years ago

Closed 6 years ago

#6200 closed Patches (fixed)

patch to have condition_variable and mutex error better handle EINTR

Reported by: blentz@… Owned by: viboes
Milestone: Boost 1.49.0 Component: thread
Version: Boost Development Trunk Severity: Problem
Keywords: 1.49 thread mutex eintr phusion passenger Cc: viboes

Description

On some flavors of Linux, for some versions of the pthread library, there are cases where it erroneously sends EINTR. This is a violation of POSIX, but it exists on some customer's production machines.

BOOST_VERIFY aborts on EINTR, but EINTR is usually not fatal, it just means you need to try later. Being that this behavior was found in production, I believe that it would be valuable to have Boost help protect downstream consumers from bad threading library behavior. This allows downstream consumers of Boost to not need to continuously rediscover and re-patch for this same bug.

So, with this in mind, attached is a proposed patch to allow condition_variable and mutex to better handle interacting with this potentially broken threading library behavior.

Attachments (1)

thread_eintr.patch (2.7 KB) - added by blentz@… 6 years ago.
patch to correct for receiving EINTR in condition_variable and mutex.

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by blentz@…

Attachment: thread_eintr.patch added

patch to correct for receiving EINTR in condition_variable and mutex.

comment:1 Changed 6 years ago by viboes

Cc: viboes added
Keywords: 1.49 added
Owner: changed from Anthony Williams to viboes
Status: newassigned

This part is not correct

        55	res=pthread_cond_wait(&cond,&internal_mutex); 

 	55	int ret; 
 	56	do { 
 	57	  ret = pthread_cond_wait(&cond,m.mutex()->native_handle()); 
 	58	} while (ret == EINTR); 

Note that before the mutex used was internal_mutex. Are you sure that this patch is working for your applications?

comment:2 Changed 6 years ago by viboes

Milestone: To Be DeterminedBoost 1.49.0

Committed in trunk revision [75781] condition variable part.

Last edited 5 years ago by viboes (previous) (diff)

comment:3 Changed 6 years ago by blentz@…

It looks like only the condition_variable and condition_variable_fwd portion of the patch was committed.

The changes to mutex are missing in revision 75781.

Was this done by choice or is it an oversight?

comment:4 Changed 6 years ago by viboes

Committed in trunk revision [75882] mutex part

Last edited 5 years ago by viboes (previous) (diff)

comment:5 Changed 6 years ago by viboes

Resolution: fixed
Status: assignedclosed

Committed in release at [76291]

Last edited 5 years ago by viboes (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.