Tags: WyriHaximus/event-loop
Tags
Fix 100% cpu usage for idle StreamSelectLoop with no timers. A null timeout must not be multiplied by an integer. Fixes reactphp#275
[EventLoop] Fix timers when using libevent-based loop. Since a closure cannot destroy itself from inside its body, to prevent PHP from raising the fatal error "Cannot destroy active lambda function" when cancelling a periodic timer from inside its callback we previously tried to postpone the call to event_free() on the affected libevent timer resource at a later stage by queueing up timer resources to be freed. This approach was quite awkward and eventually lead to complex code, difficult to test and with other unexpected side effects such as memory leaks in a couple of corner cases. This new fix greatly reduces code complexity and makes it possible to free up timer resources immediatly when cancelling a timer: we simply keep a reference of our internal timer callback from inside itself so that its refcount is still > 1 when calling event_free(), effectively preventing PHP's garbage collector to kick in when the closure is still active.
Merge branch 'master' into loop-libev * master: Fix CHANGELOG indentation Fix branch aliases of subtree splits to be 0.2-dev [Http] Correctly emit end event for Request [Http] Correctly emit close event in response Add guzzle deps update to CHANGELOG Update guzzle dependencies to 3.0.* [Http] Make response forward drain events from the connection Rename $resolver to $dns in examples Add new test-memory script that only tests the loop Conflicts: CHANGELOG.md composer.lock
PreviousNext