-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Future created with Future.delayed() sometimes fails to execute in a timely fashion #22626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
When was the first time you saw Future.delayed not being scheduled? |
It's difficult to say. Konstantin first noticed analysis getting "stuck" about 2 weeks ago, but we weren't able to track it down to Future.delayed() until about 2 days ago. So it's likely that the bug is a few weeks old. However we've recently fixed one other bug that has similar symptoms--see issue #22555 (Issue #22555 also made analysis server seem to be "stuck", but it was due to analysis getting into an infinite loop rather than going idle and failing to dispatch a future). So it's also possible that the problem we're seeing now started more recently, and we only think it's a few weeks old because it's similar to past problems. |
Fixed with r44191. Added Fixed label. |
Thanks! |
The regression test for this is failing on MIPS hardware, because it is slow and can be heavily overloaded. I think the regression test /lib/async/timer_regress22626_test.dart has a clear failure mode when the system is unresponsive for more than 50 ms, and so I am skipping it on this system. |
Expanding the MIPS-specific flaky marker in the status file to cover all architectures after seeing this on debug-x64 too. See #28254 and the older #22626. [email protected] BUG= Review-Url: https://codereview.chromium.org/2615593002 .
In the analysis server, we sometimes schedule our analysis tasks using an ordinary future:
new Future(performOperation);
and we sometimes schedule them using a very short delay:
new Future.delayed(new Duration(milliseconds: 1), performOperation)
(The short delay prevents these tasks from taking precedence over other events in the event loop which we want to be handled in a timely fashion, such as requests from the client).
We have recently observed that sometimes when an event is scheduled using Future.delayed(), it fails to execute and the process goes idle. It is as though the event loop goes into a "stuck" state where it has forgotten that an event was scheduled. This causes the appearance to the user that analysis is taking forever to complete, when in fact no analysis is being performed. Further requests from the analysis server's client (which arrive via stdin) do not "un-stick" the event, however modifying files in the filesystem (which are being watched using the "watcher" package) seems to cause enough of a kick to get the future to fire.
Anecdotally, it appears that this may be triggered by the following sequence of events: 1. task is scheduled using Future.delayed(), 2. task takes a long time to execute (~800ms), 3. task schedules itself to run again using Future.delayed()--this second future doesn't fire. However, there must be some other factors at play (microtasks or other pending events, perhaps?), because we've been unable to find a short program that reproduces the bug.
The text was updated successfully, but these errors were encountered: