What can cause a spontaneous EPIPE error without ending the close () call or failing?

I have an application that consists of two processes (let them be called A and B) connected to each other via Unix domain sockets. In most cases, it works fine, but some users report the following:

  • A sends a request to B. This works. A now begins to read the answer from B.
  • B sends the response A. The corresponding call to write () returns an EPIPE error and, as a result, B close () the socket. However, A did not close () the socket and did not crash.
  • The read () call returns 0 indicating the end of the file. A believes that B prematurely closed the connection.

Users also reported changes to this behavior, for example:

  • A sends a request to B. This works partially, but before sending the entire request. The write () call returns EPIPE and, as a result, A close () the socket. However, B did not close () the socket and did not crash.
  • B reads a partial request and then receives an EOF.

The problem is that I cannot reproduce this behavior locally at all. I tried OS X and Linux. Users are on different systems, mainly OS X and Linux.

Things I've already tried and reviewed:

  • Errors Double close () (close () is called twice in the same file descriptor): perhaps this is not the case with EBADF errors, but I have not seen them.
  • Increase the maximum file descriptor limit. One user said that it worked for him, the rest said that it wasn’t.

? , A, B close() , , , A B . ​​ - .

+5
3
+2

I would also like to check if there is a hidden firewall in the middle. Perhaps the intermediate forwarding node on the route sends RST. The best way to track this, of course, is the packet sniffer (or its GUI Cousin .)

0
source

All Articles