terrible java.net.SocketException: Broken pipe, please HELP!!

T

Tomas Penc

Hi folks,

lot of days we have problems with SocketException, thrown once per
several hours on our TCP connection (thrown in client socket) and cannot
overcome it. :-((( We already tried to find something elsewhere on web,
but it never worked out. So, please help, if you can...

We have a Socket connected over TCP and 2 threads: one reads constantly
from the socket (blocking read), one writes data time to time. The
application runs on Tomcat4.1 under Linux, Java 1.4.1. Once per several
hours the following exception is thrown while writing to socket:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
at
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
....

(We also tried it without BufferedOutputStream.)

We will be thankful for every useful comment.

regards,
Tomas Penc
 
M

Matt Humphrey

Tomas Penc said:
Hi folks,

lot of days we have problems with SocketException, thrown once per
several hours on our TCP connection (thrown in client socket) and cannot
overcome it. :-((( We already tried to find something elsewhere on web,
but it never worked out. So, please help, if you can...

We have a Socket connected over TCP and 2 threads: one reads constantly
from the socket (blocking read), one writes data time to time. The
application runs on Tomcat4.1 under Linux, Java 1.4.1. Once per several
hours the following exception is thrown while writing to socket:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
at
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
...

(We also tried it without BufferedOutputStream.)

We will be thankful for every useful comment.

Is the socket in use the entire time? Sockets will timeout and disconnect by
themselves when idle after about 2 hours.

Cheers,
Matt Humphrey (e-mail address removed) http://www.iviz.com/
 
T

Tomas Penc

Matt said:
Is the socket in use the entire time? Sockets will timeout and disconnect by
themselves when idle after about 2 hours.

Yes, there is usually lot of traffic and we are also sending keep-alives
every couple of minutes.

regards,
Tomas
 
E

EJP

If you get this you have to assume that the target has closed the socket
prematurely and react accordingly. Whether this is actually true is
another matter, it can be an artefact of transient network conditions,
but the effect is the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top