We are intermittently getting "java.io.IOException: The pipe is being closed" with below code. There is very intermittent in nature. Any advice? I tried to replicate this and when i disconnect my machine from network then i am able to get this error. This class read and write information after Siebel CRM session is open.
Here with Java class code.
private Process _process;
private OutputStream _processOut;
private ByteArrayOutputStream _sessionOutput;
....
_processOut = _process.getOutputStream();
_sessionOutput = new ByteArrayOutputStream();
....
public void writeCommand(String command)
throws IOException
{
_processOut.write(command.getBytes());
_processOut.flush();
_sessionOutput.write(command.getBytes());
}
Here with Actual error:
java.io.IOException: The pipe is being closed
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at mySession.writeCommand(mySession.java:169)
io. IOException: Broken pipe changing the value will help until the root cause (60s should be enough) can be fixed. Show activity on this post. Basically, what is happening is that your user is either closing the browser tab, or is navigating away to a different page, before communication was complete.
IOException is the base class for exceptions thrown while accessing information using streams, files and directories. The Base Class Library includes the following types, each of which is a derived class of IOException : DirectoryNotFoundException.
IOException is thrown when an error occurred during an input-output operation. That can be reading/writing to a file, a stream (of any type), a network connection, connection with a queue, a database etc, pretty much anything that has to do with data transfer from your software to an external medium.
What is happening is that the external process you are trying to write to has closed the pipe connected to its standard input stream. It may have just exited.
Try to read and print the processes standard output and standard error to see if they give an explanation as to what is going on.
Well it is the case when you have closed the streams and even after that you are trying to write data to streams...
I guess a single stream is handled in 2 threads at where one thread might have closed the stream (may be programatically or by some exception in your stream closing finally block). and the other thread is not notified and trying to write on that stream.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With