Skip Menu | will be shut down on March 1st, 2021.

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

Owner: Nobody in particular
Requestors: acferen [...]

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

Subject: recv loop needs to break out after some number of iterations
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 887
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 infrastructure.

Please report any issues with to