Skip Menu |
 

This queue is for tickets about the POE-Wheel-UDP CPAN distribution.

Report information
The Basics
Id: 46282
Status: new
Priority: 0/
Queue: POE-Wheel-UDP

People
Owner: Nobody in particular
Requestors: acferen [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.02
Fixed in: (no value)



Subject: recv loop needs to break out after some number of iterations
Download (untitled) / with headers
text/plain 887b
If data is arriving fast enough the recv loop will starve the rest of POE (the exact definition of "fast enough" depends on your environment). As a result input events stack up in POE event queue. Being stuck in the recv loop POE will seldom get a timeslice for anything other than reading data. POEs event queue will grow until the app runs out of memory (or the data rate slows). Periodically breaking out of the loop (even if there may be additional data) allows pending input events to be serviced. The basic change is: my $cnt = 25; while( $addr = recv(...) ) { ... $poe_kernel->yield( ... input_event ...); last unless --$cnt > 0; } There is nothing special about 25. It is just a number that works well for me. Something bigger than 1 is generally a good thing for high data rates since this will save on unneeded calls to select (call it select loop unrolling ;-).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.