APAR status
Closed as documentation error.
Error description
Using fopen() with a mutex results in a deadlock state during the blocking kernel call.If one thread opens a fifo for writing in blocking mode and a second thread in the same process opens a regular file, then the second thread is blocked until another process opens the fifo for reading. The fopen() function serializes all accesses to the function when in multi-threaded environment. fopen() behavior is such that when one thread is opening a file using fopen(), will cause all other threads that are doing fopen() to be blocked until the first thread finishes. . The projected closing code for this APAR is DOC
Local fix
Use open() with O_NONBLOCK on the read side of the FIFO.
Problem summary
**************************************************************** * USERS AFFECTED: z/OS Language Environment users running * * multi-threaded C/C++ applications that are * * using fopen() to open named pipes, FIFO * * files. * **************************************************************** * RECOMMENDATION: * **************************************************************** If the fopen() function is used to open named pipes in a multi- threaded environment, a deadlock will occur. The deadlock is caused by a named pipe waiting for the other end of the pipe to be opened, while still holding the fopen() multi-thread mutex.
Problem conclusion
keywords: fopen open multithread multithreaded documentation change: z/OS C/C++ Programming Guide Add the following to the end of "Using named pipes" section | Restrictions: | If fopen() is used to open named pipes in a multi-threaded | environment, a deadlock will occur. This deadlock is caused | by a named pipe waiting for the other end of the pipe to be | opened, while still holding the fopen() multi-thread mutex. | To prevent this deadlock, use open() to open the named pipe, | instead of fopen(). z/OS C/C++ Run-Time Library Reference Add the following to section "fopen() - Open a File", after the "Large Files for HFS" section. | Named Pipes in Multi-Threaded Environment | | fopen() may not be used to open named pipes in multi- | threaded environment. If used, a deadlock will occur. See | the C/C++ Programming Guide for a detailed explanation.
Temporary fix
Comments
APAR Information
APAR number
PK07789
Reported component name
LE C LIBRARY
Reported component ID
568819805
Reported release
708
Status
CLOSED DOC
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2005-06-22
Closed date
2005-08-04
Last modified date
2005-08-04
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
| SA227821XX | SC094765XX |
Fix information
Applicable component levels
[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSCVSBD","label":"Runtime"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"708","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":"708","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":"708","Edition":"","Line of Business":{"code":"","label":""}}]
Document Information
Modified date:
04 August 2005