Hi,
During long (and very active) run of simple web server, implemented using standard module, found a problem:
Indexing the NULL value with "set_nonblocking". /usr/local/pike/7.4.28/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike:62: Protocols.HTTP.Server.Request()->attach_fd(0,Protocols.HTTP.Server.Port(),bin/shttpd()->Handler) /usr/local/pike/7.4.28/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Port.pike:56: Protocols.HTTP.Server.Port()->new_connection() The fix is trivial (for 7.4.28; but the problem exists in 7.5.* as well): --- Port.pike~ 2004-01-30 00:45:12.000000000 +0100 +++ Port.pike 2004-01-30 00:45:12.000000000 +0100 @@ -52,6 +52,10 @@ static void new_connection() { Stdio.File fd=port->accept(); + + if (!fd) + return; // There is nothing to accept --aldem + Request r=request_program(); r->attach_fd(fd,this_object(),callback); }
The reason is unknown - why there is nothing to accept, but I guess it happens under _very_ heavy load (or DoS).
Regards, /Al
In the last episode (Jan 30), Alexander Demenshin said:
During long (and very active) run of simple web server, implemented using standard module, found a problem:
Indexing the NULL value with "set_nonblocking". /usr/local/pike/7.4.28/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Request.pike:62: Protocols.HTTP.Server.Request()->attach_fd(0,Protocols.HTTP.Server.Port(),bin/shttpd()->Handler) /usr/local/pike/7.4.28/lib/modules/Protocols.pmod/HTTP.pmod/Server.pmod/Port.pike:56: Protocols.HTTP.Server.Port()->new_connection() The fix is trivial (for 7.4.28; but the problem exists in 7.5.* as well):
--- Port.pike~ 2004-01-30 00:45:12.000000000 +0100 +++ Port.pike 2004-01-30 00:45:12.000000000 +0100 @@ -52,6 +52,10 @@ static void new_connection() { Stdio.File fd=port->accept();
- if (!fd)
return; // There is nothing to accept --aldem
- Request r=request_program(); r->attach_fd(fd,this_object(),callback);
}
The reason is unknown - why there is nothing to accept, but I guess it happens under _very_ heavy load (or DoS).
I can think of a few possibilities: the incoming connection closed itself between the select and accept calls, or the listening socket is marked nonblocking and new_connection gets called when there are no incoming connections, or you are out of fds. Checking port->errno() will let you tell the difference.
pike-devel@lists.lysator.liu.se