|
From: SourceForge.net <no...@so...> - 2013-03-05 19:50:52
|
Bugs item #3606965, was opened at 2013-03-05 11:50 Message generated for change (Tracker Item Submitted) made by cptnater You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=461322&aid=3606965&group_id=50884 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: libevent-core Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nate Rosenblum (cptnater) Assigned to: Nobody/Anonymous (nobody) Summary: Unexpected behavior after suspend/resume with long timer Initial Comment: When a system is suspended and resumed (e.g. when running libevent in a VM) with a long duration timer event scheduled, the event's timeout (which determines its position on the timer heap) may be in the past. This leads to unexpected behavior if the event loop is in a blocking system call (as it typically will be) and a short-duration timer event is scheduled after resuming from suspension. Because the new event will not land on top of the timer minheap, event_add will not notify the event loop thread, and so the new timer event will not fire until whatever residual duration on the pre-suspension timer event expires. Regrettably it is difficult to write a self-contained unit test that demonstrates this problem (as you need to suspend and resume the system), but it's easy enough to reproduce like so: # Register a long-duration timer event (e.g. 5 minutes) # Immediately suspend the VM # Wait > 5 minutes # Resume the VM # Schedule a short-duration timer event (e.g. 10us) # Wait ~5 minutes for both events to fire Observed w/ libevent 2.0.21 on Windows running in VMWare Fusion, but should apply everywhere. Since we already pay to get a fresh value of 'now' in event_add, it adds only a few instructions to double-check the top element's timer value to detect this condition, and if so to notify the event loop. I've submitted a pull request on github that does so. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=461322&aid=3606965&group_id=50884 |