Skip to content
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

Adding a Timeout hammers CPU even when it is not due #3812

Open
tznind opened this issue Nov 10, 2024 · 1 comment
Open

Adding a Timeout hammers CPU even when it is not due #3812

tznind opened this issue Nov 10, 2024 · 1 comment
Labels
Milestone

Comments

@tznind
Copy link
Collaborator

tznind commented Nov 10, 2024

Describe the bug

Check timers code returns true if there are any timers even if they are not due. This causes EventsPending to return true with no blocking so main loop iteration will run away with CPU.

  • Affects both NetDriver and WindowsDriver (and probably curses too)
  • Probably also happens if you add an idle
_mainLoop.CheckTimersAndIdleHandlers (out int waitTimeout)

runaway-cpu
Adding a timeout causes CPU to go up massively

To Reproduce
Add any timeout

        Application.AddTimeout (TimeSpan.FromMinutes (32),
                                () =>
                                {
                                    Debug.Write ("heya");

                                    return true;
                                });

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Set Project & Milestone
If you have access, please don't forget to set the right Project and Milestone.

@tznind tznind added the bug label Nov 10, 2024
@tznind
Copy link
Collaborator Author

tznind commented Nov 10, 2024

It affects idle to which is used internally by WindowsDriver here:

// TODO: This makes ConsoleDriver dependent on Application, which is not ideal. This should be moved to Application.
Application.MainLoop.AddIdle (
                              () =>
                              {
                                  Task.Run (async () => await ProcessContinuousButtonPressedAsync (mouseFlag));

                                  return false;
                              });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants