Modify

Ticket #8917 (closed Bugs: invalid)

Opened 9 months ago

Last modified 9 months ago

libs/log/src/once_block.cpp: Ignores nearly all failures from pthread_* functions

Reported by: Jeffrey Walton <noloader@…> Owned by: andysem
Milestone: To Be Determined Component: log
Version: Boost 1.54.0 Severity: Problem
Keywords: log mutex pthread API failure Cc:

Description

libs/log/src/once_block.cpp ignores nearly all failures from pthread_* functions. Functions include pthread_mutex_init, pthread_mutex_lock, pthread_mutex_unlock and pthread_mutex_destroy.

A lock failure is usually a bad thing, and I can't come up with scenarios where a silent failure is desired. It will make a bad problem worse by corrupting data or terminating the program.

At minimum (as a user), I would expect for Boost to use BOOST_ASSERT with an appropriate exception in debugging and diagnostic builds; and BOOST_VERIFY with an appropriate exception for release or production builds.

Perhaps it would be a good idea to use boost/thread/pthread/mutex.hpp or boost/interprocess/sync/posix/mutex.hpp. They appear to be more mature and have a bit more stability. In addition, it throws lock exceptions where appropriate.

Attachments

Change History

comment:1 Changed 9 months ago by andysem

  • Status changed from new to closed
  • Resolution set to invalid

All pthread functions are already guarded with BOOST_VERIFY. The functions must not throw any exceptions, so the only thing that can be done is to abort in case of errors.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.