The rpc getwork message does appear, but only when the worker disconnects.
This would be the exact result if nonblocking mode on the socket doesn't work. Blocking is turned off at line 1717:
$incoming->blocking(0);
Then check out line 1583:
while (<$c>){ #nonblocking
In nonblocking mode, this statement will slurp a whole line, or as much of a line as the server has received from the client. In blocking mode, this statement will wait for more data from the client until a whole line is available, or the socket is closed. The magic trick is that json rpc requests are not terminated by line breaks! So the loop hangs here waiting for an end-of-line that never comes, until the client closes the connection. At that point, since no more data will be available, the <$c> statement returns, the while loop iterates one final time, and the server tries to send a response through the closed socket. To make this work without nonblocking mode, you would need to use the perl read function on the socket - either read content-length characters after receiving a single empty line (the separator between the header and the content in http packets), or read a single character at a time until you get a valid full json object string. The dangers here is that some pools use chunked encoding instead of content length, and that you
must trust your miners to send valid requests. A single malicious request (or even accidental network-problem-related) with a content-length header, but only partial content, will hang the entire rpc server!