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

TimedPromise timed out after 500ms #1608

Open
aharui opened this issue Aug 28, 2019 · 5 comments

Comments

@aharui
Copy link

@aharui aharui commented Aug 28, 2019

System

  • Version: 0.24.0
  • Platform: macOS
  • Firefox: 68.0.2 (64-bit)
  • Selenium: 3.141.59

Testcase

See attached.
marionette.zip

I've tried to reduce this test case, but cannot figure out how. I can force the timeout by running lots of script code, but the script in reduced test cases always completes where in this larger test case the click does not seem to run script code.

Unzip and run (with Java)

java -Dwebdriver.gecko.driver=<path to>geckodriver -classpath .:<path to>selenium/client-combined-3.141.59.jar:<path to>selenium/libs/byte-buddy-1.8.15.jar:<path to>selenium/libs/commons-exec-1.3.jar:<path to>selenium/libs/guava-25.0-jre.jar:<path to>selenium/libs/okhttp-3.11.0.jar:<path to>selenium/libs/okio-1.14.0.jar TimedPromiseBugMustella file:///<path to this folder>/mustella/index.html 

Stacktrace

    TimedPromise timed out after 500 ms: stacktrace:
bail@chrome://marionette/content/sync.js:223:64

Trace-level log

See attached.
TraceLevelLog.txt

I wasn't sure whether to re-open #1584 or not.

@aharui

This comment has been minimized.

Copy link
Author

@aharui aharui commented Aug 28, 2019

This test case puts up a text input field and two buttons in a div. Clicking on the buttons increase or decrease the value in the input field.

The test script increases the value twice then tries to decrease the value. That click doesn't seem to happen and instead the TimedPromise timed out error occurs.

I've added a third increase value click to prove that it isn't the 3rd event that times out.

@whimboo

This comment has been minimized.

Copy link
Collaborator

@whimboo whimboo commented Aug 28, 2019

This warning actually comes from flushing the event loop.

If that really hides that an element hasn't been clicked, we should allow the promise to raise a timeout error. With that in-place we might get more reports of broken behavior, but at least could see where fixes would be necessary. @andreastt what do you think?

Note that I cannot run the test given that the example HTML file doesn't show any content. So maybe it was wrongly saved.

@aharui

This comment has been minimized.

Copy link
Author

@aharui aharui commented Aug 28, 2019

If you just load the HTML file, it will not show any content. The Java-based test script will cause content to appear and then run clicks on it. Please let me know if you ran the Java command-line and still didn't see any content, and maybe post your trace logs so I can compare it to my run.

@andreastt

This comment has been minimized.

Copy link
Member

@andreastt andreastt commented Sep 2, 2019

The problem is that I don’t know under what circumstances window.setTimeout(…, 0) would not fire, possibly we are missing a state check for something:

  let spinEventLoop = resolve => {
    unloadEv = resolve;
    clickEv = () => {
      if (win.closed) {
        resolve();
      } else {
        win.setTimeout(resolve, 0);
      }
    };

    win.addEventListener("unload", unloadEv, { mozSystemGroup: true });
    el.addEventListener("click", clickEv, { mozSystemGroup: true });
  };

(Above code from https://searchfox.org/mozilla-central/rev/9415ecf29ba1acbef9381335e0ecde5916ca4073/testing/marionette/interaction.js#406-418.)

We know there are a number of users affected by this problem, so making it throw will cause test cases that are currently working to start erroring, so I’m not sure that making it throw will improve the situation since we are none the wiser as to why this is happening.

A reproducible test case with some added logging to spinEventLoop might be a better approach however.

@aharui

This comment has been minimized.

Copy link
Author

@aharui aharui commented Sep 4, 2019

Let me know if you need help getting my test case to run. If I understand the responses so far, the issue may not be the way the timeout is set to fire, but rather, the timeout is an indication that in some cases, calling RemoteWebElement.click() does not actually dispatch a 'click' event that the JavaScript code sees. So if you can get my test case to run in your debuggers, the thing to debug is the code paths for how RemoteWebElement.click() ends up dispatching a 'click' event in the browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.