Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8914 closed Bugs (fixed)

boost/flyweight/detail/recursive_lw_mutex.hpp: Ignores all failures from pthread_* functions

Reported by: Jeffrey Walton <noloader@…> Owned by: Joaquín M López Muñoz
Milestone: To Be Determined Component: flyweight
Version: Boost 1.54.0 Severity: Problem
Keywords: flyweight mutex pthread API failure Cc:

Description

boost/flyweight/detail/recursive_lw_mutex.hpp ignores all failures from pthread_* functions. Functions include pthread_mutexattr_init, pthread_mutex_init, pthread_mutex_lock and pthread_mutex_unlock.

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. It appears to be more mature and have a bit more stability. In addition, it throws lock exceptions where appropriate.

Change History (2)

comment:1 by Joaquín M López Muñoz, 9 years ago

Resolution: fixed
Status: newclosed

(In [85302]) fixed #8914

comment:2 by Joaquín M López Muñoz, 9 years ago

Hi Jeffrey,

Fixed at

https://svn.boost.org/trac/boost/changeset/85302

I'd appreciate if you can check eveything's OK on your side. It is my understanding that any of these functions failing indicates a severe condition not recoverable even if exceptions are thrown, hence I've decided to simply add BOOST_VERIFY.

Have you actually found a situation where boost/flyweight/detail/recursive_lw_mutex.hpp silently failed?

Best,

Note: See TracTickets for help on using tickets.