This has been touched upon way back in forum history, but I thought it was worth a fresh mention. When writing to a socket--especially as a server--you can receive SIGPIPE. Phobos appears to try and inhibit this on some BSD systems, but on Linux if the recipient has closed the socket and you write--SIGPIPE.

And if you thought you had your bases covered with try/catch--nope! This is a _signal_, not an exception. The default for SIGPIPE is for your process to terminate. Why was my server dying? The key clue was the exit code, which led me back to SIGPIPE and then I could guess what had happened. I added a SIG_IGN of SIGPIPE and that made the problem stop. (There's also a flag MSG_NOSIGNAL to send() which might address this as well.)

With that, my web service middleware is running quite nicely. SSL, authentication, files/seeking/streaming, and parallel request dispatch.

Andy

  • TIL: writing to ... Andy Valencia via Digitalmars-d-learn

Reply via email to