What is the reason Broken Pipe for Unix domain sockets?

I have a server application that received requests and forwarded them to a Unix domain socket. This works fine with reasonable use, but when I run some load tests with several thousand queries, I get a Broken Pipe error.

I am using Java 7 with junixsocket to send requests. I have many simultaneous requests, but I have a 20-employee thread pool that writes to a unix domain socket, so there is no problem with too many concurrent open connections.

For each request, I open, send, and close the connection to the Unix Domain Socket.

What is the reason why a damaged pipe in Unix domains can be damaged?

UPDATE:

Enter a sample code if necessary:

byte[] mydata = new byte[1024];
//fill the data with bytes ...

AFUNIXSocketAddress socketAddress = new AFUNIXSocketAddress(new File("/tmp/my.sock"));
Socket socket = AFUNIXSocket.connectTo(socketAddress);
OutputStream out = new BufferedOutputStream(socket.getOutputStream());
InputStream in = new BufferedInputStream(socket.getInputStream()));

out.write(mydata);
out.flush();  //The Broken Pipe occurs here, but only after a few thousand times

//read the response back...

out.close();
in.close();
socket.close();

I have a thread pool of 20 employees, and they do it at the same time (so up to 20 simultaneous connections to the same Unix domain), each of which opens, sends, and closes. This is great for a load test of a package of 10,000 requests, but when I put a few thousand more, I suddenly get this error, so I wonder if it can exit any OS.

Keep in mind that this is a Unix Socket domain, not a TCP network socket.

+3
source share
1 answer

" " , , . - . , .

+2

All Articles