The SSL.sslfile destruct callback can hang the backend thread.
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=7066
Reported by @grubba
In a clean Roxen 5.4.66 installation:
: ###### Describing all 11 pike threads:
: >>
15:44:27 : >> ### Thread 0x1 - Backend:
1d 1h 4m : >> -:1: Thread.Thread(1)->backtrace()
: >> base_server/roxen.pike:5820: roxen()->describe_all_threads(3,_static_modules.Builtin()->threads_disabled())
: >> -:1: Pike.Backend(13)->`()(0)
: >> pike/lib/modules/SSL.pmod/sslfile.pike:1568: SSL.sslfile(Fd(31))->direct_write()
: >> pike/lib/modules/SSL.pmod/sslfile.pike:609: SSL.sslfile(Fd(31))->close(0,0,1)
15:44:27 : >> pike/lib/modules/SSL.pmod/sslfile.pike:755: SSL.sslfile(Fd(31))->destroy()
1d 1h 4m : >> -:1: Pike.Backend(0)->`()(3600.0)
: >> pike/lib/master.pike:3908: master()->_main(({"/home/www/pike/roxen/server-5.4.66/bin/roxen","-DRAM_CACHE","-DNEW_RAM_CACHE","-DHTTP_COMPRESSION","-DENABLE_THREADS","-M/home/www/pike/roxen/server-5.4.66/etc/modules",,,7}))
The server has so far stayed up since the tentative patch (2014-03-23 12:25):
$ diff -U3 sslfile.pike.orig sslfile.pike
--- sslfile.pike.orig Thu Mar 20 14:37:12 2014
+++ sslfile.pike Sun Mar 23 12:24:22 2014
@@ -597,7 +597,9 @@
RETURN (0);
}, 0);
- if (close_packet_send_state == CLOSE_PACKET_NOT_SCHEDULED)
+ if (dont_throw) {
+ close_packet_send_state = CLOSE_PACKET_MAYBE_IGNORED_WRITE_ERROR;
+ } else if (close_packet_send_state == CLOSE_PACKET_NOT_SCHEDULED)
close_packet_send_state = CLOSE_PACKET_SCHEDULED;
// Even in nonblocking mode we call direct_write here to try to