Closed Bug 1865372 Opened 7 months ago Closed 4 months ago

[macOS] Regression: Closing a youtube video from fullscreen freezes the window frame

Categories

(Core :: Widget: Cocoa, defect, P3)

defect

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox122 --- wontfix
firefox123 --- wontfix
firefox124 --- fixed

People

(Reporter: mehmet.sahin, Assigned: bradwerth)

References

Details

Attachments

(4 files)

Nightly 121.0a1 (2023-11-17)
macOS 13.6.1

STR:
1.) Open a new window on the desktop
2.) Visit youtube.com
3.) Play a video
4.) Switch into fullscreen view
5.) Press CMD-W to close the video in fullscreen

Actual: A window frame appears on the Desktop and stays for a while until it disappears

Expected: No frame should be visible.

A screenshot of the frame is attached.

This is a regression.

I can also reproduce on macOS on Nightly, and flipping full-screen-api.macos-native-full-screen to false fixes this.

Blocks: 1862223
Component: General → Widget: Cocoa
Product: Firefox → Core
Flags: needinfo?(bwerth)
Severity: -- → S3
Priority: -- → P3

Thanks for filing. I'll sort this out.

Assignee: nobody → bwerth
Flags: needinfo?(bwerth)
Attached file full_close_linger.html

Easy to reproduce on macOS with this testcase, which shows Steps to Reproduce.

Okay, this is a reappearance of Bug 757618, fixed long ago. It's happening because of the changed timing of the trigger condition, the value of mInFullScreenMode. It shouldn't be too hard to build a fix.

This seems like the right time to call DestroyNativeWindow since we are
hiding the window and destorying the nsBaseWidget -- there's not much
else that can happen to this window. Making this call here ensures that
the native window is not maintained on the screen waiting for the
destructor to be called during garbage collection.

Pushed by bwerth@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/51d87c2129d2
Call nsCocoaWindow::DestroyNativeWindow unconditionally in Destroy. r=mac-reviewers,mstange

Backed out for causing RunWatchdog crashes in test_fullscreen_modal.html

[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - PROCESS-CRASH | Shutdown hanging at step AppShutdownConfirmed. Something is blocking the main-thread. [@ mozilla::(anonymous namespace)::RunWatchdog] | dom/base/test/fullscreen/test_fullscreen_modal.html (finished) 
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Process type: main
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Process pid: 1486
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Mozilla crash reason: Shutdown hanging at step AppShutdownConfirmed. Something is blocking the main-thread.
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Crash dump filename: /var/folders/qr/jfj10xwj6k33630h30b7p09w000014/T/tmps1woxm6y.mozrunner/minidumps/0B5E6BF0-3304-474B-B9CF-F52734BE1048.dmp
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Operating system: Mac OS X
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO -                   10.15.7 19H524
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - CPU: amd64
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO -      family 6 model 158 stepping 10
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO -      12 CPUs
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - 
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Crash reason:  EXC_BAD_ACCESS / KERN_INVALID_ADDRESS
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Crash address: 0x0000000000000000
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Crashing instruction: `mov dword [0x0], 0xf4`
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Memory accessed by instruction:
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO -   0. Address: 0x0000000000000000
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO -      Size: 4
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Mac Crash Info:
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - 
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - Mac Boot Args: chunklist-security-epoch=0 -chunklist-no-rev2-dev
[task 2024-01-08T23:00:30.726Z] 23:00:30     INFO - 
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO - Process uptime: 130 seconds
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO - 
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO - Thread 72 Shutdown Hang Terminator (crashed)
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -  0  XUL!MOZ_Crash(char const*, int, char const*) [Assertions.h:51d87c2129d274294cde7bfa8a52fe1195265a73 : 281]
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -     Found by: inlining
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -  1  XUL!mozilla::(anonymous namespace)::RunWatchdog(void*) [nsTerminator.cpp:51d87c2129d274294cde7bfa8a52fe1195265a73 : 244 + 0x17]
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      rax = 0x0000000108558a28    rdx = 0x0000000000000000
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      rcx = 0x000070000f7020ac    rbx = 0x0000000131d78ca0
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      rsi = 0x00000000000120a8    rdi = 0x00007fff99698ca8
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      rbp = 0x000070000f701f70    rsp = 0x000070000f701f40
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -       r8 = 0x00000000000130a8     r9 = 0x0000000000000000
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      r10 = 0x00007fff99698cc8    r11 = 0x00007fff99698cc0
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      r12 = 0x0000000000000000    r13 = 0x0000000000000000
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      r14 = 0x000070000f701f50    r15 = 0x0000000000000007
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      rip = 0x0000000112091781
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -     Found by: given as instruction pointer in context
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -  2  libnss3.dylib!_pt_root [ptthread.c:51d87c2129d274294cde7bfa8a52fe1195265a73 : 201 + 0x6]
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      rbx = 0x0000000137662080    rbp = 0x000070000f701fb0
[task 2024-01-08T23:00:30.727Z] 23:00:30     INFO -      rsp = 0x000070000f701f80    r12 = 0x0000000000000000
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      r13 = 0x0000000000000000    r14 = 0x000070000f702000
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      r15 = 0x0000000000000007    rip = 0x0000000108ba5628
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -     Found by: call frame info
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -  3  libsystem_pthread.dylib!_pthread_start + 0x93
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      rbx = 0x000070000f702000    rbp = 0x000070000f701fd0
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      rsp = 0x000070000f701fc0    r12 = 0x0000000000000000
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      r13 = 0x0000000000000000    r14 = 0x0000000000000000
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      r15 = 0x0000000000000000    rip = 0x00007fff72ff2109
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -     Found by: call frame info
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -  4  libsystem_pthread.dylib!thread_start + 0xe
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      rbx = 0x0000000000000000    rbp = 0x000070000f701ff0
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      rsp = 0x000070000f701fe0    r12 = 0x0000000000000000
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      r13 = 0x0000000000000000    r14 = 0x0000000000000000
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -      r15 = 0x0000000000000000    rip = 0x00007fff72fedb8b
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO -     Found by: call frame info
[task 2024-01-08T23:00:30.728Z] 23:00:30     INFO - 
Flags: needinfo?(bwerth)

This is a weird test failure, due to a hang. The log shows

###!!! ERROR: Potential deadlock detected:
[task 2024-01-12T22:09:33.500Z] 22:09:33     INFO - GECKO(2402) | === Cyclical dependency starts at
[task 2024-01-12T22:09:33.501Z] 22:09:33     INFO - GECKO(2402) | --- RecursiveMutex : gfxPlatformFontList lock calling context
[task 2024-01-12T22:09:33.501Z] 22:09:33     INFO - GECKO(2402) |   [stack trace unavailable]
[task 2024-01-12T22:09:33.501Z] 22:09:33     INFO - GECKO(2402) | --- Next dependency:
[task 2024-01-12T22:09:33.502Z] 22:09:33     INFO - GECKO(2402) | --- Mutex : gfxFontFamily lock (currently acquired)
[task 2024-01-12T22:09:33.502Z] 22:09:33     INFO - GECKO(2402) |  calling context
[task 2024-01-12T22:09:33.503Z] 22:09:33     INFO - GECKO(2402) |   [stack trace unavailable]
[task 2024-01-12T22:09:33.503Z] 22:09:33     INFO - GECKO(2402) | === Cycle completed at
[task 2024-01-12T22:09:33.503Z] 22:09:33     INFO - GECKO(2402) | --- RecursiveMutex : gfxPlatformFontList lock calling context
[task 2024-01-12T22:09:33.504Z] 22:09:33     INFO - GECKO(2402) |   [stack trace unavailable]
[task 2024-01-12T22:09:33.504Z] 22:09:33     INFO - GECKO(2402) | Deadlock may happen for some other execution
[task 2024-01-12T22:09:33.505Z] 22:09:33     INFO - GECKO(2402) | [Child 2413, Main Thread] WARNING: Potential deadlock detected:
[task 2024-01-12T22:09:33.505Z] 22:09:33     INFO - GECKO(2402) | Cyclical dependency starts at
[task 2024-01-12T22:09:33.505Z] 22:09:33     INFO - GECKO(2402) | RecursiveMutex : gfxPlatformFontList lock
[task 2024-01-12T22:09:33.506Z] 22:09:33     INFO - GECKO(2402) | Next dependency:
[task 2024-01-12T22:09:33.506Z] 22:09:33     INFO - GECKO(2402) | Mutex : gfxFontFamily lock (currently acquired)
[task 2024-01-12T22:09:33.506Z] 22:09:33     INFO - GECKO(2402) | Cycle completed at
[task 2024-01-12T22:09:33.507Z] 22:09:33     INFO - GECKO(2402) | RecursiveMutex : gfxPlatformFontList lock
[task 2024-01-12T22:09:33.507Z] 22:09:33     INFO - GECKO(2402) | Deadlock may happen for some other execution

which isn't doesn't appear to be closely related to the timing of the destruction of the native window. But it does seem to be a repeatable result on the try server (though I can't replicate it locally).

Jonathan, do you have any advice for resolving font list deadlocks like this? Any sort of magic series of destruction steps that need to be followed or something?

Flags: needinfo?(bwerth) → needinfo?(jfkthame)

I'm going to try to run the whole M-spi-nw-cf chunk 5 locally -- if I can figure out the invocation -- and see if that allows me to replicate.

(In reply to Brad Werth [:bradwerth] from comment #9)

which isn't doesn't appear to be closely related to the timing of the destruction of the native window. But it does seem to be a repeatable result on the try server (though I can't replicate it locally).

Though it's true that DestroyNativeWindow has the possibility of entering a run loop which would cause deadlock. I'll think about that some more and see if I can build something more correct/safer.

I've annotated a build that shows this is creating a deadlock by spinning a local run loop where something dispatched to the main thread via NS_DispatchToCurrentThread does not get seen by that local run loop. I'm building a fix. The error log mentioning gfxPlatformFontList is not relevant here.

Flags: needinfo?(jfkthame)
Attachment #9370078 - Attachment description: Bug 1865372: Call nsCocoaWindow::DestroyNativeWindow unconditionally in Destroy. → WIP: Bug 1865372: Call nsCocoaWindow::DestroyNativeWindow unconditionally in Destroy.
Attachment #9370078 - Attachment description: WIP: Bug 1865372: Call nsCocoaWindow::DestroyNativeWindow unconditionally in Destroy. → Bug 1865372: Call nsCocoaWindow::DestroyNativeWindow more often in Destroy.
Pushed by bwerth@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e93ac2e928c9
Call nsCocoaWindow::DestroyNativeWindow more often in Destroy. r=mac-reviewers,mstange

Backed out for causing bc failures on browser_opentabs_recency.js

Backout link

Push with failures

Failure log // Failure log 2

Flags: needinfo?(bwerth)
Backout by abutkovits@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7800a7cccda7
Backed out changeset e93ac2e928c9 for causing bc failures on browser_opentabs_recency.js CLOSED TREE

Also this failure turned perma: https://treeherder.mozilla.org/logviewer?job_id=444244408&repo=autoland - TH link.

Please note that the above test is currently skipped on https://searchfox.org/mozilla-central/source/dom/tests/mochitest/pointerlock/mochitest.toml#10

tags = "fullscreen"
skip-if = [
  "os == 'android'", # Bug 1612553
  "display == 'wayland' && os_version == '22.04'", # Bug 1857057
  "!debug && !asan && !tsan && !ccov", # Bug 1833142
[task 2024-01-23T03:40:50.209Z] 03:40:50     INFO - TEST-PASS | dom/tests/mochitest/pointerlock/test_pointerlock-api.html | file_childIframe.html: MovementY of first move to childDiv should be equal to movementY of second move to child div 
[task 2024-01-23T03:40:50.209Z] 03:40:50     INFO - must wait for focus
[task 2024-01-23T03:40:50.209Z] 03:40:50     INFO - Testing file_doubleLock.html
[task 2024-01-23T03:40:50.210Z] 03:40:50     INFO - file_doubleLock.html: Resetting fullscreen enter count.
[task 2024-01-23T03:40:50.210Z] 03:40:50     INFO - TEST-PASS | dom/tests/mochitest/pointerlock/test_pointerlock-api.html | file_doubleLock.html: Should enter fullscreen. 
[task 2024-01-23T03:40:50.211Z] 03:40:50     INFO - Buffered messages finished
[task 2024-01-23T03:40:50.211Z] 03:40:50     INFO - TEST-UNEXPECTED-FAIL | dom/tests/mochitest/pointerlock/test_pointerlock-api.html | Test timed out. - 
[task 2024-01-23T03:40:51.199Z] 03:40:51     INFO - GECKO(2933) | MEMORY STAT | vsize 6662MB | residentFast 99MB | heapAllocated 7MB
[task 2024-01-23T03:40:54.430Z] 03:40:54     INFO - Error: Unable to restore focus, expect failures and timeouts.
[task 2024-01-23T03:40:54.438Z] 03:40:54     INFO - TEST-OK | dom/tests/mochitest/pointerlock/test_pointerlock-api.html | took 333846ms

This changes browser_opentabs_recency.js to check for window occlusion
before calling window.restore, and if waiting for the
occlusionstatechange event, waiting an extra event loop to ensure that
all the listeners have fired. This is necessary to ensure that the
browsing context has become active, which is the next check in the
helper function.

It also modifies pointerlock_utils.js to use the
SimpleTest.executeSoon method of delaying for an event loop. It adds
additional logging to file_doubleLock.html to determine whether the
pointerlockchange events are getting swallowed.

The pointerlockchange test fixups are being handled in Bug 1833142. I'm going to remove all changes to those tests from this patch stack.

Depends on: 1833142

Bug 1833142 has landed but is leave-open, so I'm removing it as a dependency, and sending this to landing.

No longer depends on: 1833142
See Also: → 1833142
Pushed by bwerth@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c90c3ae24e99
Call nsCocoaWindow::DestroyNativeWindow more often in Destroy. r=mac-reviewers,mstange
https://hg.mozilla.org/integration/autoland/rev/9e9da481d3d8
Part 2: Update test timings. r=fxview-reviewers,sfoster
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

Flags: needinfo?(bwerth)

The patch landed in nightly and beta is affected.
:bradwerth, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox123 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(bwerth)
Regressions: 1877749

I don't think this needs to go to Beta. It's a minor visual issue, and it's been around awhile.

Flags: needinfo?(bwerth)
Regressions: 1879816
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: