[Ace-users] Re: [ace-bugs] ACE_Process_Mutex acquisition fails after fork and exit of parent

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Mon Sep 17 14:36:28 CDT 2007


[Martin, there's a question for you below.]

Hi Nathan,

   Thanks for using the PRF.

>    ACE VERSION: 5.5.1
>
>    HOST MACHINE and OPERATING SYSTEM:
>        Linux Red Hat ES/AS 3.0 & 4.0 and
>        Solaris 9, 10
>
>    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
>    COMPILER NAME AND VERSION (AND PATCHLEVEL):
>
>    THE $ACE_ROOT/ace/config.h FILE
>
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>
>
>/* There is supposed to be another way to turn this on,
>   but I can't find it, and this should suffice. */
>/* Tag the ACE symbols with version info to avoid name collisions. */
>#define ACE_HAS_VERSIONED_NAMESPACE 1
>
>#define ACE_HAS_STANDARD_CPP_LIBRARY 1
>#define ACE_NTRACE 1
>#define ACE_NLOGGING 1
>#define ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES 1
>
>#ifdef _WIN32
>#include "config_win32.h"
>#endif
>
>#ifdef __linux__
>#include "config_linux.h"
>#endif
>
>#if defined (__SUNPRO_CC)
>//#include "config_sunos5.7.h"
>#include "config_sunos5.8.h"
>//#include "config_sunos5.9.h"
>#endif
>
>/* Get around bug for VS.NET 2003 */
>#if (_MSC_VER >=3D 1300 && _MSC_VER < 1400)
>#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
>#endif
>
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>
>
>    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE
>        for Linux:    platform_linux.GNU
>        for Solaris:  platform_sunos5_sunc++.GNU
>
>    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
>    (used by MPC when you generate your own makefiles):
>
>    AREA/CLASS/EXAMPLE AFFECTED:
>
>    DOES THE PROBLEM AFFECT:
>        COMPILATION?
>        LINKING?
>        EXECUTION?
>            Yes.
>        OTHER (please specify)?
>
>    SYNOPSIS:
>        ACE_Process_Mutex acquisition fails after fork and exit of
>parent.
>
>    DESCRIPTION:
>        If you statically declare a named ACE_Process_Mutex object on
>        Linux or Solaris, then fork(), and then exit the parent process,
>        the child process will be unable to acquire the mutex.
>        It fails with EINVAL.

Martin, is this something you could take a look at?  

Thanks,

        Doug

>    REPEAT BY:
>        Here is a small test program that illustrates the problem.
>
>#include "ace/ACE.h"
>#include "ace/Process_Mutex.h"
>
>ACE_Process_Mutex foo_mutex("test_mut");
>
>main()
>{
>    if (fork() > 0)
>    {
>        printf("Main process exiting\n");
>        exit(0);
>    }
>
>    printf("About to acquire...\n");
>    sleep(5);
>    if (foo_mutex.tryacquire())
>        perror("Acquire failed");
>    else
>    {
>        printf("Acquire succeeded\n");
>        foo_mutex.release();
>    }
>}

-- 
Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu



More information about the Ace-users mailing list