A fix is available
APAR status
Closed as program error.
Error description
Problem using popen() in a multi-threaded environment. Setup: A master process is protecting a resource using a mutex semaphore #1: RESOURCE #0001: NAME=Mutex Object ADDR=21F39A78 The master process set a pthread_atfork() handler to lock the semaphore before the fork; after the fork, parent and child are unlocking() the semaphore. Scenario: The mutex semaphore #1 is unlocked. The master process is starting 10 threads in a row and waiting as each thread is starting a child using popen("Child Name","r"), and also waiting for the child exit with pclose() and the thread is exiting. Failure: Only one child was successfully started and was exiting. But the rest of the threads are locked.
Local fix
Problem summary
**************************************************************** * USERS AFFECTED: Multithreaded C/C++ applications that * * register fork handlers and directly * * or indirectly (e.g. popen()) call fork(). * **************************************************************** * PROBLEM DESCRIPTION: Processing of the prepare fork * * handlers in fork() uses a mutex to * * lock the fork handler queue during * * traversal of the queue and execution * * of the prepare handlers. A timing * * window exists in a multi-threaded * * environment in which other threads * * may deadlock waiting for this mutex. * **************************************************************** * RECOMMENDATION: * **************************************************************** See problem description.
Problem conclusion
The locking code around the processing of the prepare handlers is not really necessary and has been removed to eliminate the possibility of a deadlock. In a multi-threaded application, users must insure that all fork handlers required by the application are registered prior to calling fork() from any thread.
Temporary fix
Comments
APAR Information
APAR number
PK59693
Reported component name
LE C LIBRARY
Reported component ID
568819805
Reported release
740
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2008-01-22
Closed date
2008-06-02
Last modified date
2008-07-01
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
UK36980 UK36981
Modules/Macros
CELHFORK CELQFORK EDC40129
Fix information
Fixed component name
LE C LIBRARY
Fixed component ID
568819805
Applicable component levels
Fix is available
Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.
[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSCVSBD","label":"Runtime"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"740","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"740","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":null,"label":null},"Product":{"code":"SG19O","label":"APARs - MVS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"740","Edition":"","Line of Business":{"code":"","label":""}}]
Document Information
Modified date:
01 July 2008