Closed Bug 1927144 Opened 1 year ago Closed 1 year ago

Intermittent remote/shared/messagehandler/test/browser/browser_handle_command_retry.js | test_forced_no_retry_cross_group| A promise chain failed to handle a rejection: BrowsingContext with id "<random>" does no longer exist

Categories

(Remote Protocol :: Agent, defect, P5)

defect
Points:
2

Tracking

(firefox134 fixed)

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: jdescottes)

References

Details

(Keywords: intermittent-failure, intermittent-testcase, Whiteboard: [webdriver:m13])

Attachments

(1 file)

The test test_forced_no_retry_cross_group that will be added by bug 1927073 is failing when the following assertion is done:

    ok(
      !(await hasPromiseResolved(onDiscarded)),
      "waitForDiscardedBrowsingContext should not have resolved yet"
    );

This happens because of the following line:

promise.finally(() => (resolved = true));

The failure is:

  FAIL A promise chain failed to handle a rejection: BrowsingContext with id "18" does no longer exist - stack: RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
MessageHandlerError@chrome://remote/content/shared/messagehandler/Errors.sys.mjs:14:5
DiscardedBrowsingContextError@chrome://remote/content/shared/messagehandler/Errors.sys.mjs:76:5
_sendCommandToBrowsingContext@chrome://remote/content/shared/messagehandler/transports/RootTransport.sys.mjs:138:13
forwardCommand@chrome://remote/content/shared/messagehandler/transports/RootTransport.sys.mjs:74:19
forwardCommand@chrome://remote/content/shared/messagehandler/RootMessageHandler.sys.mjs:162:36
waitForDiscardedBrowsingContext@chrome://mochitests/content/browser/remote/shared/messagehandler/test/browser/resources/modules/root/retry.sys.mjs:37:32
async*handleCommand@chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs:257:33
test_forced_no_retry_cross_group@chrome://mochitests/content/browser/remote/shared/messagehandler/test/browser/browser_handle_command_retry.js:164:44
async*handleTask@chrome://mochikit/content/browser-test.js:1145:26

It's not exactly clear at this point why this extra promises is leaking. For now we are going to land the patch on bug 1927073 with this particular assertion commented out.

Depends on: 1927073

Given that this might indicate a problem with forwarding commands it might be good to get it investigated and fixed. Shall we take it for M13?

Whiteboard: [webdriver:triage]
Duplicate of this bug: 1927412

The hasPromisedResolved can leak promise rejections in some cases.

Eg the following test will fail due to an uncaught promise rejection:

add_task(async function test_hasPromiseResolved() {
  async function callCommand() {
    // The timeout below is just to delay a bit the promise, not realy necessary.
    // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
    await new Promise(r => setTimeout(r, 500));
    await forwardCommand();
  }

  async function forwardCommand() {
    throw new Error("Some message");
  }

  const onPromiseError = callCommand();

  // Calling this test helper will leak a promise rejection.
  ok(!(await hasPromiseResolved(onPromiseError)));

  await Assert.rejects(
    onPromiseError,
    e => e.message == "Some message",
    "Caught the expected error"
  );
});
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Points: --- → 2
Whiteboard: [webdriver:triage] → [webdriver:m13]
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/de0d10943f46 [remote] Fix test helper hasPromiseResolved r=webdriver-reviewers,whimboo
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: