Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 27833
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: perl [...] pied.nu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.33
  • 0.3301
  • 0.34
  • 0.3401
  • 0.35
  • 0.3501
  • 0.36
  • 0.3601
  • 0.37
  • 0.38
  • 0.9917
  • 0.9989
Fixed in: (no value)



Subject: PoCo::Server::TCP could get a negative connection count
It is all to easy for badly writen code to send more then one 'disconnected' event to a PoCo::Server::TCP instance. When this happens, {connections} will go below 0, which is bad and wrong. Included patch detects this, complains and sets the connection count to 0.
Subject: Philip_Gwyn-POE-connections-check.0.patch
diff -rub POE-0.9989-orig/lib/POE/Component/Server/TCP.pm POE-0.9989/lib/POE/Component/Server/TCP.pm --- POE-0.9989-orig/lib/POE/Component/Server/TCP.pm 2006-09-05 11:54:33.000000000 -0400 +++ POE-0.9989/lib/POE/Component/Server/TCP.pm 2007-06-30 01:35:08.000000000 -0400 @@ -363,6 +363,10 @@ "$$: $_[HEAP]->{alias} Connection closed ", "($_[HEAP]->{connections} open)" ); + if( $_[HEAP]->{connections} < 0 ) { + warn( "Excessive 'disconected' event from $_[CALLER_FILE] at line $_[CALLER_LINE]\n" ); + $_[HEAP]->{connections} = 0; + } if( $_[HEAP]->{concurrency} != -1 and $_[HEAP]->{listener} ) { if( $_[HEAP]->{connections} == ($_[HEAP]->{concurrency}-1) ) { DEBUG and warn( Only in POE-0.9989/lib/POE/Component/Server: TCP.pm~
Thanks for the patch, and thanks for tracking the problem here. I've finally applied it as revision 2196.