Closed Bug 1369207 Opened 7 years ago Closed 3 years ago

Firefox hang on CGLClearDrawable after quickly closing window after FEATURE_FAILURE_OPENGL_CREATE_CONTEXT

Categories

(Core :: Graphics: Layers, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: myk, Unassigned)

Details

(Keywords: crash, hang, Whiteboard: [gfx-noted])

On macOS installations where opening a window logs: |[GFX1-]: [OPENGL] Failed to init compositor with reason: FEATURE_FAILURE_OPENGL_CREATE_CONTEXT|, quickly closing the window can deadlock in CGLClearDrawable.

Here's a crash report: https://crash-stats.mozilla.com/report/index/db324969-a10b-46ac-94e1-4a3920170531

And the stack in lldb:

* thread #1: tid = 0x151ea, 0x00007fff87ebb746 libsystem_kernel.dylib`__psynch_mutexwait + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff87ebb746 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x00007fff8a393779 libsystem_pthread.dylib`_pthread_mutex_lock + 372
    frame #2: 0x00007fff87a71d1b OpenGL`CGLClearDrawable + 42
    frame #3: 0x00007fff8a23be0c CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    frame #4: 0x00007fff8a12f82d CoreFoundation`_CFXNotificationPost + 2893
    frame #5: 0x00007fff8f266dda Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 68
    frame #6: 0x00007fff82f8c5a9 AppKit`-[NSSurface _disposeSurface] + 152
    frame #7: 0x00007fff82f8c045 AppKit`-[NSSurface setWindow:] + 70
    frame #8: 0x00007fff82eb7f27 AppKit`-[NSView _setWindow:] + 2282
    frame #9: 0x00007fff82eb8f7a AppKit`-[NSView removeFromSuperview] + 350
    frame #10: 0x0000000107e284c6 XUL`-[ChildView delayedTearDown] + 22
    frame #11: 0x00007fff8f2c775e Foundation`__NSThreadPerformPerform + 229
    frame #12: 0x00007fff8a19e5b1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #13: 0x00007fff8a18fd29 CoreFoundation`__CFRunLoopDoSources0 + 441
    frame #14: 0x00007fff8a18f3ef CoreFoundation`__CFRunLoopRun + 831
    frame #15: 0x00007fff8a18ee75 CoreFoundation`CFRunLoopRunSpecific + 309
    frame #16: 0x00007fff8e8c6a0d HIToolbox`RunCurrentEventLoopInMode + 226
    frame #17: 0x00007fff8e8c67b7 HIToolbox`ReceiveNextEventCommon + 479
    frame #18: 0x00007fff8e8c65bc HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 65
    frame #19: 0x00007fff82ea124e AppKit`_DPSNextEvent + 1434
    frame #20: 0x00007fff82ea089b AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
    frame #21: 0x0000000107e5bf96 XUL`-[GeckoNSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 86
    frame #22: 0x00007fff82e9499c AppKit`-[NSApplication run] + 553
    frame #23: 0x0000000107e5ce51 XUL`nsAppShell::Run() + 209
    frame #24: 0x00000001091a3ef9 XUL`nsAppStartup::Run() + 41
    frame #25: 0x0000000109240762 XUL`XREMain::XRE_mainRun() + 3874
    frame #26: 0x0000000109240ec0 XUL`XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) + 1408
    frame #27: 0x00000001092412df XUL`XRE_main(int, char**, mozilla::BootstrapConfig const&) + 223
    frame #28: 0x00000001052d5f4c firefox`main + 924
    frame #29: 0x00000001052d5b84 firefox`start + 52
Whiteboard: [gfx-noted]
Sometimes I also see this message when the app hangs:

> Dec 31 15:59:59 Myks-Mac-VM-10-9.local firefox[74806] <Error>: CGBitmapContextGetWidth: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
And when I see that message referencing CGBitmapContextGetWidth, a second one appears that references CGBitmapContextGetHeight.  (I didn't mention that in the last comment because I thought the second message was a duplicate.  I only just noticed that it actually references a different method.)
Severity: normal → critical
Keywords: crash, hang
Summary: Firefox hang on quickly closing window after FEATURE_FAILURE_OPENGL_CREATE_CONTEXT → Firefox hang on CGLClearDrawable after quickly closing window after FEATURE_FAILURE_OPENGL_CREATE_CONTEXT

Hi Myk/jbonisteel. We're wondering whether there is a connection between this bug report and bug 1381485. That bug has a ton of comments so I'll hopefully save some time by pointing out bug 1381485 comment 273 and the specific forum posting https://forum.juce.com/t/opengl-deadlocks-mac/8933/12 (I've cc Christopher, the author of that comment, and a couple developers)

Flags: needinfo?(myk)
Flags: needinfo?(jbonisteel)

Hi Wayne, unfortunately I haven't experienced this bug in years, and I can't reproduce it on my current macOS laptop, nor do I know anything about the issue beyond what I've written in this report; so I don't know if the two bugs are related.

Flags: needinfo?(myk)

Not sure yet about correlation. Wayne, can you consistently reproduce this bug (ie. the non-Thunderbird bug) as well?

Flags: needinfo?(jbonisteel)

I am just a facilitator in this process - I've never seen it, plus I'm new to Mac and in truth only part time (using an Air circa 2012 with Intel HD Graphics 4000) with "Use hardware acceleration" disabled.

For the cohort in bug 1381485 who regularly experience the issue reported there, the current working theory is this happens mostly (but not exclusively) on older Macs with integrated graphics and "Use hardware acceleration" enabled, i.e. "layers.acceleration.disabled", false, which is NOT the default for Thunderbird. The default is "disabled", unlike Firefox where the default is enabled (depending on hardware I guess).

There are a couple people like Scott in bug 1381485 comment 316 who can easily reproduce and seem technically adept.

Does that help? What additional information do we need? And, if you are not the person able to help debug this graphics issue, who is?

Flags: needinfo?(jbonisteel)

Several, including Scott in bug 1381485 comment 326, report the crash goes away by changing the pref.

Flags: needinfo?(jbonisteel)

Hey Myk,
Can you still reproduce this issue or should we close it?

Flags: needinfo?(myk)

Hi Andrei, I can't reproduce this issue anymore, so unless someone else can do so, I suggest closing it.

Flags: needinfo?(myk)

Marking this as Resolved > Worksforme as per reporter's last response.
If anyone can still reproduce this issue re-open it or file a new bug.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.