Closed Bug 1977802 Opened 8 months ago Closed 6 months ago

Intermittent /webdriver/tests/bidi/integration/parallel_execution/browsing_context_print.py | test_when_browsingcontext_recreated - Failed: DID NOT RAISE <class 'webdriver.bidi.error.UnknownErrorException'>

Categories

(Remote Protocol :: WebDriver BiDi, defect, P5)

defect
Points:
2

Tracking

(firefox144 fixed)

RESOLVED FIXED
144 Branch
Tracking Status
firefox144 --- fixed

People

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

Details

(Keywords: intermittent-failure, Whiteboard: [webdriver:m17], [wptsync upstream])

Attachments

(1 file)

Filed by: amarc [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=518262984&repo=try
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/aI7LStj8ShufUge4m7lc_A/runs/0/artifacts/public/logs/live_backing.log


task 2025-07-17T11:31:56.443+00:00] 11:31:56     INFO - PID 2947 | 1752751916439	geckodriver::android	DEBUG	Stop forwarding WebSocket port (34747 -> 2829)
[task 2025-07-17T11:31:56.443+00:00] 11:31:56     INFO - PID 2947 | 1752751916439	mozdevice	TRACE	execute_host_command: >> "host:transport:emulator-5554"
[task 2025-07-17T11:31:56.443+00:00] 11:31:56     INFO - PID 2947 | 1752751916439	mozdevice	TRACE	execute_host_command: << []
[task 2025-07-17T11:31:56.444+00:00] 11:31:56     INFO - PID 2947 | 1752751916439	mozdevice	TRACE	execute_host_command: >> "host-serial:emulator-5554:killforward:tcp:9222"
[task 2025-07-17T11:31:56.444+00:00] 11:31:56     INFO - PID 2947 | 1752751916439	mozdevice	TRACE	execute_host_command: << ""
[task 2025-07-17T11:31:56.444+00:00] 11:31:56     INFO - PID 2947 | 1752751916439	webdriver::server	DEBUG	<- 200 OK {"value":null}
[task 2025-07-17T11:31:56.445+00:00] 11:31:56     INFO - STDOUT: =================================== FAILURES ===================================
[task 2025-07-17T11:31:56.445+00:00] 11:31:56     INFO - STDOUT: _____________________ test_when_browsingcontext_recreated ______________________
[task 2025-07-17T11:31:56.446+00:00] 11:31:56     INFO - STDOUT: bidi_session = <webdriver.bidi.client.BidiSession object at 0x7f99729b9dc0>
[task 2025-07-17T11:31:56.446+00:00] 11:31:56     INFO - STDOUT: wait_for_future_safe = <function wait_for_future_safe.<locals>.wait_for_future_safe at 0x7f9970364720>
[task 2025-07-17T11:31:56.447+00:00] 11:31:56     INFO - STDOUT: inline = <function inline.<locals>.inline at 0x7f9970364cc0>
[task 2025-07-17T11:31:56.447+00:00] 11:31:56     INFO - STDOUT:     async def test_when_browsingcontext_recreated(
[task 2025-07-17T11:31:56.448+00:00] 11:31:56     INFO - STDOUT:         bidi_session, wait_for_future_safe, inline
[task 2025-07-17T11:31:56.448+00:00] 11:31:56     INFO - STDOUT:     ):
[task 2025-07-17T11:31:56.448+00:00] 11:31:56     INFO - STDOUT:         new_tab = await bidi_session.browsing_context.create(type_hint="tab")
[task 2025-07-17T11:31:56.449+00:00] 11:31:56     INFO - STDOUT:     
[task 2025-07-17T11:31:56.449+00:00] 11:31:56     INFO - STDOUT:         page = inline("<div>foo</div>")
[task 2025-07-17T11:31:56.450+00:00] 11:31:56     INFO - STDOUT:         await bidi_session.browsing_context.navigate(
[task 2025-07-17T11:31:56.450+00:00] 11:31:56     INFO - STDOUT:             context=new_tab["context"], url=page, wait="complete"
[task 2025-07-17T11:31:56.450+00:00] 11:31:56     INFO - STDOUT:         )
[task 2025-07-17T11:31:56.451+00:00] 11:31:56     INFO - STDOUT:     
[task 2025-07-17T11:31:56.451+00:00] 11:31:56     INFO - STDOUT:         printed_future = await bidi_session.send_command(
[task 2025-07-17T11:31:56.452+00:00] 11:31:56     INFO - STDOUT:             "browsingContext.print",
[task 2025-07-17T11:31:56.452+00:00] 11:31:56     INFO - STDOUT:             {
[task 2025-07-17T11:31:56.452+00:00] 11:31:56     INFO - STDOUT:                 "context": new_tab["context"],
[task 2025-07-17T11:31:56.453+00:00] 11:31:56     INFO - STDOUT:             },
[task 2025-07-17T11:31:56.453+00:00] 11:31:56     INFO - STDOUT:         )
[task 2025-07-17T11:31:56.453+00:00] 11:31:56     INFO - STDOUT:     
[task 2025-07-17T11:31:56.454+00:00] 11:31:56     INFO - STDOUT:         await bidi_session.browsing_context.close(context=new_tab["context"])
[task 2025-07-17T11:31:56.454+00:00] 11:31:56     INFO - STDOUT:     
[task 2025-07-17T11:31:56.455+00:00] 11:31:56     INFO - STDOUT:         # Closing the browsing context for printing may leave the print-preview
[task 2025-07-17T11:31:56.455+00:00] 11:31:56     INFO - STDOUT:         # window open. Make sure that creating a new tab doesn’t reference this
[task 2025-07-17T11:31:56.455+00:00] 11:31:56     INFO - STDOUT:         # window, which could cause failures.
[task 2025-07-17T11:31:56.456+00:00] 11:31:56     INFO - STDOUT:         await bidi_session.browsing_context.create(type_hint="tab")
[task 2025-07-17T11:31:56.456+00:00] 11:31:56     INFO - STDOUT:     
[task 2025-07-17T11:31:56.456+00:00] 11:31:56     INFO - STDOUT: >       with pytest.raises(error.UnknownErrorException):
[task 2025-07-17T11:31:56.457+00:00] 11:31:56     INFO - STDOUT: E       Failed: DID NOT RAISE <class 'webdriver.bidi.error.UnknownErrorException'>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - 
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - TEST-UNEXPECTED-FAIL | /webdriver/tests/bidi/integration/parallel_execution/browsing_context_print.py | test_when_browsingcontext_recreated - Failed: DID NOT RAISE <class 'webdriver.bidi.error.UnknownErrorException'>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - bidi_session = <webdriver.bidi.client.BidiSession object at 0x7f99729b9dc0>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - wait_for_future_safe = <function wait_for_future_safe.<locals>.wait_for_future_safe at 0x7f9970364720>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - inline = <function inline.<locals>.inline at 0x7f9970364cc0>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - 
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -     async def test_when_browsingcontext_recreated(
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         bidi_session, wait_for_future_safe, inline
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -     ):
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         new_tab = await bidi_session.browsing_context.create(type_hint="tab")
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -     
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         page = inline("<div>foo</div>")
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         await bidi_session.browsing_context.navigate(
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -             context=new_tab["context"], url=page, wait="complete"
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         )
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -     
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         printed_future = await bidi_session.send_command(
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -             "browsingContext.print",
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -             {
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -                 "context": new_tab["context"],
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -             },
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         )
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -     
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         await bidi_session.browsing_context.close(context=new_tab["context"])
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -     
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         # Closing the browsing context for printing may leave the print-preview
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         # window open. Make sure that creating a new tab doesn’t reference this
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         # window, which could cause failures.
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -         await bidi_session.browsing_context.create(type_hint="tab")
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO -     
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - >       with pytest.raises(error.UnknownErrorException):
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - E       Failed: DID NOT RAISE <class 'webdriver.bidi.error.UnknownErrorException'>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - 
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - bidi_session = <webdriver.bidi.client.BidiSession object at 0x7f99729b9dc0>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - inline     = <function inline.<locals>.inline at 0x7f9970364cc0>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - new_tab    = {'context': 'f0708aa4-6908-45ed-9705-e381eede358a'}
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - page       = 'https://web-platform.test:8443/webdriver/tests/support/inline.py?doc=%3C%21doctype+html%3E%0A%3Cmeta+charset%3DUTF-8%3E%0A%3Cdiv%3Efoo%3C%2Fdiv%3E&mime=text%2Fhtml&charset=UTF-8'
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - printed_future = <Future finished result={'data': 'JVBERi0xLjcK...xCiUlRU9GCg=='}>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - wait_for_future_safe = <function wait_for_future_safe.<locals>.wait_for_future_safe at 0x7f9970364720>
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - 
[task 2025-07-17T11:31:56.459+00:00] 11:31:56     INFO - tests/web-platform/tests/webdriver/tests/bidi/integration/parallel_execution/browsing_context_print.py:32: Failed
[task 2025-07-17T11:31:56.460+00:00] 11:31:56     INFO - TEST-OK | /webdriver/tests/bidi/integration/parallel_execution/browsing_context_print.py | took 5874ms
[task 2025-07-17T11:31:56.460+00:00] 11:31:56     INFO - Restarting browser for new test group
[task 2025-07-17T11:31:56.524+00:00] 11:31:56     INFO - STDOUT: bidi_session = <webdriver.bidi.client.BidiSession object at 0x7f99729b9dc0>
[task 2025-07-17T11:31:56.525+00:00] 11:31:56     INFO - STDOUT: inline     = <function inline.<locals>.inline at 0x7f9970364cc0>
[task 2025-07-17T11:31:56.525+00:00] 11:31:56     INFO - STDOUT: new_tab    = {'context': 'f0708aa4-6908-45ed-9705-e381eede358a'}
[task 2025-07-17T11:31:56.525+00:00] 11:31:56     INFO - STDOUT: page       = 'https://web-platform.test:8443/webdriver/tests/support/inline.py?doc=%3C%21doctype+html%3E%0A%3Cmeta+charset%3DUTF-8%3E%0A%3Cdiv%3Efoo%3C%2Fdiv%3E&mime=text%2Fhtml&charset=UTF-8'
[task 2025-07-17T11:31:56.526+00:00] 11:31:56     INFO - STDOUT: printed_future = <Future finished result={'data': 'JVBERi0xLjcK...xCiUlRU9GCg=='}>
[task 2025-07-17T11:31:56.526+00:00] 11:31:56     INFO - STDOUT: wait_for_future_safe = <function wait_for_future_safe.<locals>.wait_for_future_safe at 0x7f9970364720>
[task 2025-07-17T11:31:56.526+00:00] 11:31:56     INFO - STDOUT: tests/web-platform/tests/webdriver/tests/bidi/integration/parallel_execution/browsing_context_print.py
[task 2025-07-17T11:31:56.526+00:00] 11:31:56     INFO - STDOUT: :32: Failed
[task 2025-07-17T11:31:56.527+00:00] 11:31:56     INFO - STDOUT: =========================== short test summary info ============================
[task 2025-07-17T11:31:56.527+00:00] 11:31:56     INFO - STDOUT: FAILED tests/web-platform/tests/webdriver/tests/bidi/integration/parallel_execution/browsing_context_print.py::test_when_browsingcontext_recreated - Failed: DID NOT RAISE <class 'webdriver.bidi.error.UnknownErrorException'>
[task 2025-07-17T11:31:56.528+00:00] 11:31:56     INFO - STDOUT: ============================== 1 failed in 5.71s ===============================
[task 2025-07-17T11:31:56.528+00:00] 11:31:56     INFO - Closing logging queue
[task 2025-07-17T11:31:56.528+00:00] 11:31:56     INFO - queue closed

This is probably a race given that browsing context re-creation will certainly take longer due to the slower hardware.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #4)

This is probably a race given that browsing context re-creation will certainly take longer due to the slower hardware.

So this is indeed a race condition but not because its slower hardware. The Android 14 emulator seem to be actually faster than the Android 7 emulator and the test page that we are trying to print is just <div>foo</div>. Because this is a quite small page the printing command will be done immediately, which means that closing and opening a new browsing context will happen afterward.

As such I tried to enlarge the screenshot size by adding a margin-top: 10000px to the test. This will produce a way larger screenshot and should take more than a second. By local testing this is enough time to make the test pass. I'll upload the patch and do a try build to verify the fix.

Points: --- → 2
Whiteboard: [webdriver:m17]
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7e79fa1872f4 https://hg.mozilla.org/integration/autoland/rev/fa22459a0979 [wdspec] Fix race in parallel_execution/browsing_context_print.py. r=webdriver-reviewers,Sasha
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/54718 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m17] → [webdriver:m17], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: