Crash under heavy load
Brought to you by:
drozd
Embebed server crashes under heavy load (v1.37). I traced it back to a null handle. Following patch stops the crashing, but doesn't fix the problem.
--- shttpd.c 6 Feb 2007 21:55:49 -0000 1.2
+++ shttpd.c 9 Feb 2007 02:53:23 -0000 1.3
@@ -811,6 +811,12 @@
len = io_data_len(&from->io);
assert(len > 0);
+ if (to == NULL || to->io_class == NULL) {
+ io_clear (&from->io);
+ stop_stream(to);
+ DBG(("write_stream failed to->io_class is NULL"));
+ return;
+ }
/* TODO: should be assert on CAN_WRITE flag */
n = to->io_class->write(to, io_data(&from->io), len);