roxen.lists.pike.general

Subject Author Date
socket->accept returning 0 Philipp Hancke <fippo[at]goodadvice[dot]pages[dot]de> 15-12-2008
hej,

from the 7.8 beta announcement

 > o Protocols.HTTP.Server
 >  - If accept() fails on the open port, the Port object will continue
 >    trying, to support servers with high load.

This might be related to a strange behaviour I experienced a while ago
with Stdio.Port. If the pike process runs out of file descriptors the
accept callback is called over and over again and cpu usage is high.

I can detect when I run out of file descriptors (_socket->accept returns
0 and _socket->errno() is 24), but I don't know how to reject the new
connection. Detecting when this failure is about to happen (i.e. knowing
the number of file descriptors I have left) would be a bonus.

The attached files should serve as a minimal test case. To reproduce the
behaviour, it is necessary to adjust ulimit -n before running
connect.pike.

Adjusting ulimit -n fixes the problem obviously ;-)

philipp
-- 
74e3b4d380fbe32a955e047efc82c713eab5d5f186b65046b613ad6d3513bd30