A fix is available
APAR status
Closed as new function.
Error description
New Function APAR.
Local fix
Problem summary
**************************************************************** * USERS AFFECTED: All C/C++ applications that use pipes or * * sockets to communicate between processes. * **************************************************************** * PROBLEM DESCRIPTION: A hang condition may occur between two * * processes that use pipes or sockets for * * communication. * * * * The following is a scenario of an * * example where the hang may occur: * * * * A parent and child process are using * * pipes for communication purposes. The * * child process wants to send a prompt to * * the parent process and then read the * * response. The parent must see the * * prompt, capture a response, and then * * send the response back to the child. * * If the child sends the prompt without a * * trailing newline or without calling * * fflush, the prompt is never placed into * * the pipe for the parent to read. The * * child then tries to read the response. * * The application hangs (parent cannot * * read the prompt that it needs to * * respond to and the child cannot read * * the response from the parent). * * * * The same problem exists when sockets * * are used in the scenario described * * above. * **************************************************************** * RECOMMENDATION: * **************************************************************** See problem description.
Problem conclusion
Temporary fix
Comments
The following documentation update is required in the z/OS XL C/C++ Programming Guide. Document number SC09-4765-08 and newer versions. Chapter 31. Using environment variables AFTER _EDC_ERRNO_DIAG ADD THE FOLLOWING: _EDC_FLUSH_STDOUT_PIPE Flush the stdout stream when the stdin stream is being read when both are pipes. ADD THE FOLLOWING: _EDC_FLUSH_STDOUT_SOCKET Flush the stdout stream when the stdin stream is being read when both are sockets. Chapter 31. Using environment variables In Topic: Environment variables specific to the z/OS XL C/C++ library Section: The z/OS XL C/C++ specific environment variables may be set with the setenv() function. In Subtopics: after _EDC_ERRNO_DIAG insert _EDC_FLUSH_STDOUT_PIPE insert _EDC_FLUSH_STDOUT_SOCKET Chapter 31. Using environment variables Section 4.12.2.nn AFTER _EDC_ERRNO_DIAG ADD THE FOLLOWING: _EDC_FLUSH_STDOUT_PIPE Instructs the C runtime library to flush the stdout stream when the stdin stream is being read from. Both stdin and stdout must be pipes. _EDC_FLUSH_STDOUT_PIPE is set with the command: setenv("_EDC_FLUSH_STDOUT_PIPE","YES",1); Usage scenario: The purpose of this environment variable is to better facilitate communication between two processes that use pipes. The child process is using stdin for the read end of one pipe and stdout for the write end of a different pipe. The parent process has the opposite ends of the pipes. The following is a possible example of the communication: The child process wants to send a prompt to the parent process and then read the response. The parent must see the prompt, capture a response, and then send the response back to the child. If the child sends the prompt without a trailing newline or without calling fflush, the prompt is never placed into the pipe for the parent to read. The child then tries to read the response from stdin. The application hangs (parent cannot read the prompt that it needs to respond to and the child cannot read the response from the parent). With the environment variable set to YES, the read from stdin will flush the stdout buffer. This allows the parent to see the prompt, respond, then send the response back to the child who is waiting on the read. Since the data comes back from the parent, the child reads the response and continues. It should be mentioned that the parent process must do a read() from the pipe so that it can receive whatever data might be there without having to wait for a specific number of bytes or a newline character. Functions like fread() and fgets() will hang unless the child wrote enough bytes or the newline character to stdout. ADD THE FOLLOWING: _EDC_FLUSH_STDOUT_SOCKET Instructs the C runtime library to flush the stdout stream when the stdin stream is being read from. Both stdin and stdout must be sockets. _EDC_FLUSH_STDOUT_SOCKET is set with the command: setenv("_EDC_FLUSH_STDOUT_SOCKET","YES",1); Usage scenario: The purpose of this environment variable is to better facilitate communication between two processes that use sockets. The child process is using stdin for the read end of one socket and stdout for the write end of a different socket. The parent process has the opposite ends of the sockets. The following is a possible example of the communication: The child process wants to send a prompt to the parent process and then read the response. The parent must see the prompt, capture a response, and then send the response back to the child. If the child sends the prompt without a trailing newline or without calling fflush, the prompt is never placed into the socket for the parent to read. The child then tries to read the response from stdin. The application hangs (parent cannot read the prompt that it needs to respond to and the child cannot read the response from the parent). With the environment variable set to YES, the read from stdin will flush the stdout buffer. This allows the parent to see the prompt, respond, then send the response back to the child who is waiting on the read. Since the data comes back from the parent, the child reads the response and continues. It should be mentioned that the parent process must do a read() from the socket so that it can receive whatever data might be there without having to wait for a specific number of bytes or a newline character. Functions like fread() and fgets() will hang unless the child wrote enough bytes or the newline character to stdout.
APAR Information
APAR number
PK64852
Reported component name
LE C LIBRARY
Reported component ID
568819805
Reported release
740
Status
CLOSED UR1
PE
NoPE
HIPER
NoHIPER
Special Attention
YesSpecatt / New Function / Xsystem
Submitted date
2008-04-22
Closed date
2009-07-24
Last modified date
2009-09-02
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Modules/Macros
CELHCINT CELHGTNV CELHP124 CELHP125 CELJGTNV CELQGTNV CELQINC CELQP124 CELQP125 CELXCEDB CELZGTNV CTABLE EDCCEDB EDC40072 EDC4009F EDC4024D EDC4024E HFSIO
SC094765NN |
Fix information
Fixed component name
LE C LIBRARY
Fixed component ID
568819805
Applicable component levels
R740 PSY UK48678
UP09/08/13 P F908
R750 PSY UK48679
UP09/08/13 P F908
R760 PSY UK48680
UP09/08/13 P F908
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:
02 September 2009