Subject: | POE filehandle leak |
Date: | Fri, 24 Apr 2009 18:41:18 -0400 (EDT) |
To: | bug-POE [...] rt.cpan.org |
From: | sean.pieper [...] viable.net |
Dear POE maintainers,
I've discovered a filehandle leak in POE, intially with v 1.003 and confirmed still present in 1.005. This leak was first spotted in a production server where clients connect and are authorized and logged in a database before further interactions. The database access can take a while when we get a large number of clients connecting simultaneously, and if some clients drop off in the meantime, we quickly leak filehandles (not sockets though-- the network stuff gets shutdown properly).
Effectively, what happens for the leak is:
socketfactory creates a new socket
new socket gets wrapped as a wheel::readwrite
wheel::readwrite gets input and kicks off an event to the session handling DB communication
wheel::readwrite receives close
DB session completes, and wheel::readwrite is collected
filehandle is still kicking around.
I've written what I believe is a minimal demonstration (attached). This bug only appears if I post to a separate session-- if the slow (outstanding) event is in the same session that creates the wheels, there is no leak. If the outstanding event is resolved before the socket closes, the filehandle is also correctly cleaned.
Please let me know if I can do anything further to help resolve this issue. I'm trying to track down a high load deadlock in my server code, and I'd like to eliminate this bug as a potential culprit.
Thanks for a really useful framework.
-sean
Sean Pieper
Engineer
Viable, Inc.
VRS: ViableVRS.tv
www.viable.net
sean.pieper@viable.net
Office: 240-292-0222 x244
VSN: viablepieper
This e-mail, including any attachments may contain information that is protected by law as PRIVILEGED AND CONFIDENTIAL and is intended solely for the use of the recipient or the employee or agent responsible for delivering the message to the recipient. Please note that if you are not the intended recipient, you are hereby notified that any dissemination, copying, distribution, retention, re-transmission, printing or any other use of this e-mail or the information contained herein is strictly prohibited. If you have received this e-mail communication in error, please immediately send an e-mail reply to notify the sender and immediately and permanently delete this e-mail from your computer system. Thank you.
I've discovered a filehandle leak in POE, intially with v 1.003 and confirmed still present in 1.005. This leak was first spotted in a production server where clients connect and are authorized and logged in a database before further interactions. The database access can take a while when we get a large number of clients connecting simultaneously, and if some clients drop off in the meantime, we quickly leak filehandles (not sockets though-- the network stuff gets shutdown properly).
Effectively, what happens for the leak is:
socketfactory creates a new socket
new socket gets wrapped as a wheel::readwrite
wheel::readwrite gets input and kicks off an event to the session handling DB communication
wheel::readwrite receives close
DB session completes, and wheel::readwrite is collected
filehandle is still kicking around.
I've written what I believe is a minimal demonstration (attached). This bug only appears if I post to a separate session-- if the slow (outstanding) event is in the same session that creates the wheels, there is no leak. If the outstanding event is resolved before the socket closes, the filehandle is also correctly cleaned.
Please let me know if I can do anything further to help resolve this issue. I'm trying to track down a high load deadlock in my server code, and I'd like to eliminate this bug as a potential culprit.
Thanks for a really useful framework.
-sean
Sean Pieper
Engineer
Viable, Inc.
VRS: ViableVRS.tv
www.viable.net
sean.pieper@viable.net
Office: 240-292-0222 x244
VSN: viablepieper
This e-mail, including any attachments may contain information that is protected by law as PRIVILEGED AND CONFIDENTIAL and is intended solely for the use of the recipient or the employee or agent responsible for delivering the message to the recipient. Please note that if you are not the intended recipient, you are hereby notified that any dissemination, copying, distribution, retention, re-transmission, printing or any other use of this e-mail or the information contained herein is strictly prohibited. If you have received this e-mail communication in error, please immediately send an e-mail reply to notify the sender and immediately and permanently delete this e-mail from your computer system. Thank you.
Message body not shown because it is not plain text.