[Solved]HTTPServer SIGPIPE crash with ssl.write() lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- zeljko · 2022-04-07 09:50 Testing TCustomHTTPApplication (custhttpapp) as webserver (REST API - sqldbrestbridge) and everything works fine except that I can broke pipe from client and in that case server crashes. Testing client is curl. It's easy to reproduce - start curl with opts, and point to some big table on server side, imediatelly after start curl press Ctrl+C - server crashes. gdb pointed me to ssl_write()->BIO_write()->libc.write() ... Found that crash comes from ssl, exactly from ssl_write() -> BIO_write() and that ssl does not have (at least libssl.1.1 from my linuxmint) some flag to ignore SIGPIPE but crashes Is there any way to set SIGPIPE to ignore on linux, so my server won't crash when reader pipe is down ? Anyone have same problem ? Tried with fpSignal() but it does not work at all. Don't know if it crashes without SSL (pure http) because I need only https protocol. ---------------------------------------------------------------------- zeljko · 2022-04-07 14:37 hmmm....I've implemented gnutls with GNUTLS_NO_SIGNAL, so it does not crash when SIGPIPE occurs (GNUTLS_E_PUSH_ERROR), but fpc httpserver sends buffer again even result is -1 so server is blocked, each new thread (connection) waits.....anyone ? ---------------------------------------------------------------------- sstvmaster · 2022-04-07 20:05 Here in the german forum PascalDragon, wrote a solution: https://www.lazarusforum.de/viewtopic.php?p=118745#p118745 ---------------------------------------------------------------------- zeljko · 2022-04-07 20:51 Quote from: sstvmaster on April 07, 2022, 10:05:30 pmHere in the german forum PascalDragon, wrote a solution: https://www.lazarusforum.de/viewtopic.php?p=118745#p118745 Thanks a lot @sstvmaster ---------------------------------------------------------------------- zeljko · 2022-04-07 21:22 Now it does not crash, but also sever is not responding for new client connections , same thing like with gnutls when NO_SIGNAL flag is added to init gnutls server socket. ---------------------------------------------------------------------- zeljko · 2022-04-08 14:44 It works fine now with gnutls & openssl, responding problem was due to my  wrong code, leavecriticasection was at the wrong place