Search Unity

Crash/Hang occasionally but consistently when changing resolution/windowed/fullscreen

Discussion in 'macOS' started by peetron, Mar 15, 2018.

  1. peetron

    peetron

    Joined:
    Jul 7, 2013
    Posts:
    7
    Unity: 2017.2.1p1
    Platform: Osx - 10.13.3 - iMac 2013
    Processor: intel core i5
    Graphics: GTX 775M 2 GB

    Reproduction Process:
    In the settings menu of the game with have a resolution dropdown and a fullscreen/windowed checkbox. If I play with this for a while changing resolution and changing windowed/fullscreen I will encounter this crash/hang. It results in the game window blanked to black and not responding to input.

    Sometimes it takes 30 resolution/fullscreen/windowed changes and sometimes it takes 3 or 4 changes for it to occur but if I go for long enough it's always reproducible. I have only been testing with it set to 30fps on the one machine.

    The code to change the resolution is:

    Screen.SetResolution(
    resolution.width, resolution.height, Screen.fullScreen, resolution.refreshRate);
    *or*
    Screen.fullScreen = isFullScreen;

    The code is called from a TMP_Dropdown.DropdownEvent onValueChanged event or a
    UnityEngine.UI.Toggle onValueChanged event.


    Here are three examples of the crash/hang in the player log. They are similar but not identical.
    ---

    Receiving unhandled NULL exception
    Obtained 29 stack frames.
    #0 0x000000a6af868f in objc_loadWeakRetained
    #1 0x000000a6af9c8d in objc_loadWeak
    #2 0x000000919f2efa in __32-[NSOpenGLContext clearDrawable]_block_invoke
    #3 0x0000009148a3c0 in NSPerformVisuallyAtomicChange
    #4 0x0000009160874b in -[NSOpenGLContext clearDrawable]
    #5 0x0000000035f363 in -[PlayerWindowView setContext:]
    #6 0x00000000361e61 in ScreenManagerOSXStandalone::SetResolutionImmediate(int, int, bool, int)
    #7 0x000000007a2024 in ScreenManager::SetRequestedResolution()
    #8 0x000000009d287a in InitPlayerLoopCallbacks()::postLateUpdateUpdateResolutionRegistrator::Forward()
    #9 0x000000009d3c32 in PlayerLoop()
    #10 0x0000000035d936 in -[PlayerAppDelegate UpdatePlayer]
    #11 0x0000009538f520 in __NSFireTimer
    #12 0x00000093954873 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
    #13 0x000000939543e8 in __CFRunLoopDoTimer
    #14 0x00000093953e5b in __CFRunLoopDoTimers
    #15 0x0000009394ba9b in __CFRunLoopRun
    #16 0x0000009394aae1 in CFRunLoopRunSpecific
    #17 0x0000009394a84a in CFRunLoopRunInMode
    #18 0x00000092f4a42b in RunCurrentEventLoopInMode
    #19 0x00000092f4a152 in ReceiveNextEventCommon
    #20 0x00000092f49e2b in _BlockUntilNextEventMatchingListInModeWithFilter
    #21 0x00000091371cc5 in _DPSNextEvent
    #22 0x00000091ae3c48 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
    #23 0x00000091ae3115 in -[NSApplication(NSEvent) nextEventMatchingMask:untilDate:inMode:dequeue:]
    #24 0x00000003400c10 in -[NSApplication(SteamOverrideNextEvent) steamhooked_nextEventMatchingMask:untilDate:inMode:dequeue:]
    #25 0x00000091366c19 in -[NSApplication run]
    #26 0x00000091338cce in NSApplicationMain
    #27 0x0000000035d257 in PlayerMain(int, char const**)
    #28 0x000000a75a66e1 in start

    ---

    Receiving unhandled NULL exception
    Obtained 29 stack frames.
    #0 0x000000a6af868f in objc_loadWeakRetained
    #1 0x000000a6af9c8d in objc_loadWeak
    #2 0x000000919f2efa in __32-[NSOpenGLContext clearDrawable]_block_invoke
    #3 0x0000009148a3c0 in NSPerformVisuallyAtomicChange
    #4 0x0000009160874b in -[NSOpenGLContext clearDrawable]
    #5 0x0000000035f363 in -[PlayerWindowView setContext:]
    #6 0x00000000361e61 in ScreenManagerOSXStandalone::SetResolutionImmediate(int, int, bool, int)
    #7 0x000000007a2024 in ScreenManager::SetRequestedResolution()
    #8 0x000000009d287a in InitPlayerLoopCallbacks()::postLateUpdateUpdateResolutionRegistrator::Forward()
    #9 0x000000009d3c32 in PlayerLoop()
    #10 0x0000000035d936 in -[PlayerAppDelegate UpdatePlayer]
    #11 0x0000009538f520 in __NSFireTimer
    #12 0x00000093954873 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
    #13 0x000000939543e8 in __CFRunLoopDoTimer
    #14 0x00000093953e5b in __CFRunLoopDoTimers
    #15 0x0000009394ba9b in __CFRunLoopRun
    #16 0x0000009394aae1 in CFRunLoopRunSpecific
    #17 0x0000009394a84a in CFRunLoopRunInMode
    #18 0x00000092f4a42b in RunCurrentEventLoopInMode
    #19 0x00000092f4a152 in ReceiveNextEventCommon
    #20 0x00000092f49e2b in _BlockUntilNextEventMatchingListInModeWithFilter
    #21 0x00000091371cc5 in _DPSNextEvent
    #22 0x00000091ae3c48 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
    #23 0x00000091ae3115 in -[NSApplication(NSEvent) nextEventMatchingMask:untilDate:inMode:dequeue:]
    #24 0x00000003400c10 in -[NSApplication(SteamOverrideNextEvent) steamhooked_nextEventMatchingMask:untilDate:inMode:dequeue:]
    #25 0x00000091366c19 in -[NSApplication run]
    #26 0x00000091338cce in NSApplicationMain
    #27 0x0000000035d257 in PlayerMain(int, char const**)
    #28 0x000000a75a66e1 in start

    ---

    Receiving unhandled NULL exception
    Obtained 32 stack frames.
    #0 0x000000a6af411d in _cache_getImp
    #1 0x000000a6af6eee in lookUpImpOrNil
    #2 0x000000a6af6e97 in class_getMethodImplementation
    #3 0x000000a6af8701 in objc_loadWeakRetained
    #4 0x000000a6af9c8d in objc_loadWeak
    #5 0x000000919f2efa in __32-[NSOpenGLContext clearDrawable]_block_invoke
    #6 0x0000009148a3c0 in NSPerformVisuallyAtomicChange
    #7 0x0000009160874b in -[NSOpenGLContext clearDrawable]
    #8 0x0000000035f363 in -[PlayerWindowView setContext:]
    #9 0x00000000361e61 in ScreenManagerOSXStandalone::SetResolutionImmediate(int, int, bool, int)
    #10 0x000000007a2024 in ScreenManager::SetRequestedResolution()
    #11 0x000000009d287a in InitPlayerLoopCallbacks()::postLateUpdateUpdateResolutionRegistrator::Forward()
    #12 0x000000009d3c32 in PlayerLoop()
    #13 0x0000000035d936 in -[PlayerAppDelegate UpdatePlayer]
    #14 0x0000009538f520 in __NSFireTimer
    #15 0x00000093954873 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
    #16 0x000000939543e8 in __CFRunLoopDoTimer
    #17 0x00000093953e5b in __CFRunLoopDoTimers
    #18 0x0000009394ba9b in __CFRunLoopRun
    #19 0x0000009394aae1 in CFRunLoopRunSpecific
    #20 0x0000009394a84a in CFRunLoopRunInMode
    #21 0x00000092f4a42b in RunCurrentEventLoopInMode
    #22 0x00000092f4a152 in ReceiveNextEventCommon
    #23 0x00000092f49e2b in _BlockUntilNextEventMatchingListInModeWithFilter
    #24 0x00000091371cc5 in _DPSNextEvent
    #25 0x00000091ae3c48 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
    #26 0x00000091ae3115 in -[NSApplication(NSEvent) nextEventMatchingMask:untilDate:inMode:dequeue:]
    #27 0x00000003400c10 in -[NSApplication(SteamOverrideNextEvent) steamhooked_nextEventMatchingMask:untilDate:inMode:dequeue:]
    #28 0x00000091366c19 in -[NSApplication run]
    #29 0x00000091338cce in NSApplicationMain
    #30 0x0000000035d257 in PlayerMain(int, char const**)
    #31 0x000000a75a66e1 in start

    ---

    Receiving unhandled NULL exception
    Obtained 29 stack frames.
    #0 0x000000a6af868f in objc_loadWeakRetained
    #1 0x000000a6af9c8d in objc_loadWeak
    #2 0x000000919f2efa in __32-[NSOpenGLContext clearDrawable]_block_invoke
    #3 0x0000009148a3c0 in NSPerformVisuallyAtomicChange
    #4 0x0000009160874b in -[NSOpenGLContext clearDrawable]
    #5 0x0000000035f363 in -[PlayerWindowView setContext:]
    #6 0x00000000361e61 in ScreenManagerOSXStandalone::SetResolutionImmediate(int, int, bool, int)
    #7 0x000000007a2024 in ScreenManager::SetRequestedResolution()
    #8 0x000000009d287a in InitPlayerLoopCallbacks()::postLateUpdateUpdateResolutionRegistrator::Forward()
    #9 0x000000009d3c32 in PlayerLoop()
    #10 0x0000000035d936 in -[PlayerAppDelegate UpdatePlayer]
    #11 0x0000009538f520 in __NSFireTimer
    #12 0x00000093954873 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
    #13 0x000000939543e8 in __CFRunLoopDoTimer
    #14 0x00000093953e5b in __CFRunLoopDoTimers
    #15 0x0000009394ba9b in __CFRunLoopRun
    #16 0x0000009394aae1 in CFRunLoopRunSpecific
    #17 0x0000009394a84a in CFRunLoopRunInMode
    #18 0x00000092f4a42b in RunCurrentEventLoopInMode
    #19 0x00000092f4a152 in ReceiveNextEventCommon
    #20 0x00000092f49e2b in _BlockUntilNextEventMatchingListInModeWithFilter
    #21 0x00000091371cc5 in _DPSNextEvent
    #22 0x00000091ae3c48 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
    #23 0x00000091ae3115 in -[NSApplication(NSEvent) nextEventMatchingMask:untilDate:inMode:dequeue:]
    #24 0x00000003400c10 in -[NSApplication(SteamOverrideNextEvent) steamhooked_nextEventMatchingMask:untilDate:inMode:dequeue:]
    #25 0x00000091366c19 in -[NSApplication run]
    #26 0x00000091338cce in NSApplicationMain
    #27 0x0000000035d257 in PlayerMain(int, char const**)
    #28 0x000000a75a66e1 in start
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    This has got to be a Unity bug. I appreciate you sharing it with us here, but please be sure to file an official bug report with Unity too.
     
  3. Avelblood

    Avelblood

    Joined:
    May 5, 2016
    Posts:
    6
    Same problem. Tested on three macs, on two this happens at every start, instantly crashing application. On third it happens at 40% of launches.
    Any solutions?