Subject: [Boost-bugs] [Boost C++ Libraries] #9321: named mutex permissions are not reset after application crash
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-30 12:08:25
#9321: named mutex permissions are not reset after application crash
-------------------------------------------------+-------------------------
Reporter: Marcus Ackermann | Owner: igaztanaga
<Marcus.Ackermann@â¦> | Status: new
Type: Bugs | Component:
Milestone: To Be Determined | interprocess
Version: Boost 1.50.0 | Severity: Problem
Keywords: |
-------------------------------------------------+-------------------------
'''Using boost named_mutex on Windows with the standard permissions
object.'''
An application creates a named mutex and removes it on exit. This works
fine even if the application is started by different users one after the
other.
Now assume the application crashes and does not call remove, anymore. When
a different user starts the same application later on, the named mutex
cannot be created and throws an interprocess exception "access denied".
This is due to the fact that the mutex file in the folder
{{{c:\ProgramData\boost_interprocess}}} still exists, and it has the
permissions of the user that started the application first.
'''How to reproduce'''
The following simple application simulates a crash by exiting before
removing the mutex.
Run the application as user x. The mutex is successfully constructed, the
application crashes unexpectedly.
Then run the application as user y. The mutex cannot be constructed as
file {{{c:\ProgramData\boost_interprocess\my_mutex_name}}} is still
present and cannot be opened by user y although user x who owns the file
does not use it by any process.
{{{
#include "boost/interprocess/sync/named_mutex.hpp"
int main(const int argc, const char* const * const argv)
{
try
{
boost::interprocess::named_mutex
mutex(boost::interprocess::open_or_create, "my_mutex_name");
printf("mutex construction successful\n");
}
catch (const boost::interprocess::interprocess_exception& ex)
{
printf("mutex construction failed: %s\n", ex.what());
}
exit(0);
boost::interprocess::named_mutex::remove("my_mutex_name");
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9321> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC