AgNO3 / junixsocket

Java Unixsocket Library
Other
2 stars 4 forks source link

Broken pipe error occurs sporadically #2

Open siddharthoak opened 8 years ago

siddharthoak commented 8 years ago

We have written a proxy for Docker and since it works over unix socket, we have used jnuixsocket.

We are encountering the "Broken pipe" error sporadically. The same code executes correctly on other occasions. Unfortunately I have not figured out the reason behind this behavior. Can you please suggest any pointers that may help me get over the problem. The version of the the library we have used is 2.0.4.

Caused by: java.io.IOException: Broken pipe at Socket[addr=null,port=0,localport=0][fd=java.io.FileDescriptor@67575e30; file=/run/docker.sock; connected=true; bound=false] at org.newsclub.net.unix.AFUNIXSocketImpl$AFUNIXOutputStream.write(AFUNIXSocketImpl.java:256) ~[junixsocket-common-2.0.4.jar:na]

mbechler commented 8 years ago

Broken pipe generally means that the remote endpoint closed it's reading side of the connection you are writing to. Given that this is a system error, I wouldn't suspect the library to do anything wrong at this point.

I don't know anything about the docker API you are using but it looks like that is HTTP, so you might want to check that you properly handle Connection: close if using keep-alive (that is if you send multiple requests over the same connection). Could also be a reaction to a malformed request or a bug in the server implementation. Do you have any idea when this happens, i.e. when starting a new request or in the middle of one? Maybe try to get some debug logging from docker?

If everything else fails and you suspect the library we would need to get further information. straces of both the processes involved would be helpful to see what really is happening there.