Subject: | POE::Wheel::ReadWrite sometimes didn't free resources |
POE-0.3202; Perl 5.8.0 & 5.8.6; SuSE Linux 8.2 (Kernel 2.4.20) & 9.3 (kernel 2.6.11).
The problem: during intensive handling of network connections, processed by Wheel::ReadWrite (bound to socket), sessions didn't stop after ErrorEvent is fired (actually, this is normal "connection closed" event, i.e. ErrorEvent with args 'read' and error code 0). Normally, this event occurs when client closes the connection, but sometimes, _very_ seldom, it happens "by itself" - no idea why.
This problem is extremely difficult to reproduce - it could take thousands of requests with high concurrency before the problem appears.
I tried to forge a quick-fix, which does the trick - problem disappears. Not sure if I did right thing, but... below is the patch against POE/Wheel/ReadWrite.pm:
--- ReadWrite.pm~ 2005-10-24 15:06:06.000000000 +0200
+++ ReadWrite.pm 2005-10-24 15:06:06.000000000 +0200
@@ -186,6 +186,7 @@
$me, $$event_error, 'write', ($!+0), $!, $unique_id
);
$k->select_write($handle);
+ $k->select_read($handle);
}
# Could write, or perhaps couldn't but only because the
@@ -286,6 +287,7 @@
$me, $$event_error, 'read', ($!+0), $!, $unique_id
);
$k->select_read($handle);
+ $k->select_write($handle);
}
}
);
@@ -314,6 +316,7 @@
$me, $$event_error, 'read', ($!+0), $!, $unique_id
);
$k->select_read($handle);
+ $k->select_write($handle);
}
}
);