1

I get this error every time my program reaches a write() function. The program will continue again, but will stop on the next write() call. When I run this program outside of gdb, it runs properly.

Program received signal SIGPIPE, Broken pipe.
0x00007ffff794b340 in __write_nocancel () at ../sysdeps/unix/syscall-template.S:81
81      ../sysdeps/unix/syscall-template.S: No such file or directory.

I've been told that this happens when the socket is closed from the remote end, but how would that be happening.

Note: The server and client are both running on the same machine, and the server was prebuilt for me, so I don't have access to it's code.

Eric Siegal
  • 258
  • 1
  • 3
  • 14

1 Answers1

6

SIGPIPE is generated when the other side closed the connection. And there are good reasons for its existence.

By default gdb catches SIGPIPE.

If you aren't interested, and chances are you don't, simply disable it:

handle SIGPIPE nostop noprint pass

I've been told that this happens when the socket is closed from the remote end, but how would that be happening.

You mean why? Since you don't have the source we can only guess.

Perhaps it already sent all the data it wanted and closed the connection, because there's no point keeping it open... Remember, connections can be half-closed (that is, from one side). The server doesn't want to read any further, and just waits you to read the data and close your side. Probably nothing went wrong - but you have to decide that yourself, as only you know what the application protocol is.

Community
  • 1
  • 1
Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176