obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.15k stars 7.96k forks source link

Captured Game Crashes to Desktop When Switching Scenes #11003

Open 0Ky opened 3 months ago

0Ky commented 3 months ago

Operating System Info

Windows 11

Other OS

No response

OBS Studio Version

30.2.0

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/n1G7SlTcgGtXC7pW

OBS Studio Crash Log URL

No response

Expected Behavior

The captured game should continue running and be captured by OBS without crashing when switching scenes.

Current Behavior

Upon switching scenes in OBS Studio, the captured game (Half-Life 1) crashes to the desktop without any error message. This crash occurs consistently when switching back to a scene containing the Game Capture source for Half-Life 1. The Windows debugger indicates that the crash is caused by an unhandled exception in _graphicshook32.dll, where the DLL attempts to read from a null pointer, resulting in an access violation (c0000005) error. This issue is only present in OBS version 30.2.0 and does not occur in version 30.1.2 under identical conditions.

Steps to Reproduce

  1. Launch OBS Studio (version 30.2.0).
  2. Add a "Game Capture" source to capture Half-Life 1 (hl.exe) window.
  3. Create a new scene, switch to it and then switch back to the scene containing the "Game Capture" source.
  4. Observe that the game crashes to the desktop.

Anything else we should know?

WinDbg Output

Starting from Scene 2 with no sources, switching to Scene 1 with a game capture source:

ModLoad: 59340000 5937c000   C:\ProgramData\obs-studio-hook\graphics-hook32.dll
[OBS] graphics-hook.dll loaded against process: hl.exe
[OBS] (half life scientist) everything..  seems to be in order
[OBS] Hooked ID3D12CommandQueue::ExecuteCommandLists
[OBS] Hooked D3D12
[OBS] Hooked IDXGISwapChain::Present
[OBS] Hooked IDXGISwapChain::ResizeBuffers
[OBS] Hooked IDXGISwapChain1::Present1
[OBS] Hooked DXGI
[OBS] Hooked SwapBuffers
[OBS] Hooked wglDeleteContext
[OBS] Hooked wglSwapLayerBuffers
[OBS] Hooked wglSwapBuffers
[OBS] Hooked GL
[OBS] Shared-texture OpenGL capture available
[OBS] gl shared texture capture successful
[OBS] Remembering D3D12 queue from present: queue=0x192806B0

Switching from Scene 1 to Scene 2:

[OBS] ------------------ gl capture freed ------------------
[OBS] Found D3D12 device on swap chain: swap=0x19286B30, device=0x168993C0
[OBS]     queue=0x192806B0

Switching from Scene 2 to Scene 1 [crashed here]:

[OBS] gl shared texture capture successful
(59bc.3720): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=192c0050 ecx=1769cb84 edx=00000004 esi=00000000 edi=00000000
eip=59342916 esp=1769cb70 ebp=1769cbc8 iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246
graphics_hook32+0x2916:
59342916 8b06            mov     eax,dword ptr [esi]  ds:002b:00000000=????????
0:014> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

KEY_VALUES_STRING: 1

    Key  : AV.Dereference
    Value: NullPtr

    Key  : AV.Fault
    Value: Read

    Key  : Analysis.CPU.mSec
    Value: 1281

    Key  : Analysis.Elapsed.mSec
    Value: 2567

    Key  : Analysis.IO.Other.Mb
    Value: 0

    Key  : Analysis.IO.Read.Mb
    Value: 1

    Key  : Analysis.IO.Write.Mb
    Value: 0

    Key  : Analysis.Init.CPU.mSec
    Value: 2686

    Key  : Analysis.Init.Elapsed.mSec
    Value: 292290

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 69

    Key  : Failure.Bucket
    Value: NULL_POINTER_READ_c0000005_graphics-hook32.dll!Unknown

    Key  : Failure.Hash
    Value: {d53de7bf-e052-2ed0-0beb-e165392ff9b2}

    Key  : Timeline.OS.Boot.DeltaSec
    Value: 7970

    Key  : Timeline.Process.Start.DeltaSec
    Value: 122

    Key  : WER.OS.Branch
    Value: ni_release

    Key  : WER.OS.Version
    Value: 10.0.22621.1

    Key  : WER.Process.Version
    Value: 1.1.1.1

NTGLOBALFLAG:  0

APPLICATION_VERIFIER_FLAGS:  0

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 59342916 (graphics_hook32+0x00002916)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 00000000
   Parameter[1]: 00000000
Attempt to read from address 00000000

FAULTING_THREAD:  00003720

PROCESS_NAME:  hl.exe

READ_ADDRESS:  00000000 

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  00000000

EXCEPTION_PARAMETER2:  00000000

STACK_TEXT:  
WARNING: Stack unwind information not available. Following frames may be wrong.
1769cbc8 59344f7e     19286b30 192c0050 1769cd54 graphics_hook32+0x2916
1769cbe8 634f86e9     01286b30 00000000 00000200 graphics_hook32+0x4f7e
1769ccd8 634f9d01     634f9cb5 169aa420 634f9d01 atioglxx!DrvSetCallbackProcs+0x195e79
1769cd24 634a2c37     1769cd54 16a928c8 00000000 atioglxx!DrvSetCallbackProcs+0x197491
1769cd80 632f1ec7     16a928c8 45432892 411cbcc0 atioglxx!DrvSetCallbackProcs+0x1403c7
1769f950 632ef53c     193aeb18 632ef53c 411cbcc0 atioglxx!DllMain+0x8c6d97
1769f9a4 632f472d     07de65b8 45432806 632f4700 atioglxx!DllMain+0x8c440c
1769f9c4 63786161     16a6b888 4543283e 63786109 atioglxx!DllMain+0x8c95fd
1769f9fc 77487ba9     166a9e08 77487b90 1769fa64 atioglxx!eglGetProcAddress+0x7ac61
1769fa0c 7784c10b     166a9e08 8c3bec87 00000000 KERNEL32!BaseThreadInitThunk+0x19
1769fa64 7784c08f     ffffffff 77879e5a 00000000 ntdll!__RtlUserThreadStart+0x2b
1769fa74 00000000     63786109 166a9e08 00000000 ntdll!_RtlUserThreadStart+0x1b

SYMBOL_NAME:  graphics_hook32+2916

MODULE_NAME: graphics_hook32

IMAGE_NAME:  graphics-hook32.dll

STACK_COMMAND:  ~14s ; .cxr ; kb

FAILURE_BUCKET_ID:  NULL_POINTER_READ_c0000005_graphics-hook32.dll!Unknown

OS_VERSION:  10.0.22621.1

BUILDLAB_STR:  ni_release

OSPLATFORM_TYPE:  x86

OSNAME:  Windows 10

IMAGE_VERSION:  1.8.3.0

FAILURE_ID_HASH:  {d53de7bf-e052-2ed0-0beb-e165392ff9b2}

Followup:     MachineOwner
---------
mrcalland commented 2 months ago

hi did you ever fix this issue I have this I've even gone back to obs 30.1.0 to see if that fixes it and it doesn't the game ROCKSMITH is still crashing to desktop.

0Ky commented 2 months ago

@mrcalland Unfortunately the issue still persists. I've updated OBS to version 30.2.3 (64-bit), verified file integrity and the result is the same.

Can you explain more about your issue? Does your OBS crash when switching scenes? It would be great if you can share log file too.

mrcalland commented 2 months ago

no my OBS is totally fine its the game its capturing that crashes out and its to do with the scene switcher I use in streamer.bot I disabled it and the issue stopped so it was definitely that.

I may need to delay the switcher so that my game can process its part before the scene switches as both programs doing that at the same time maybe making it crash (old pc issue lol)

0Ky commented 2 months ago

I just noticed that if I launch the game, then hide the game capture source and unhide it, my game crashes immediately. I'm curious if the same thing happens to you. This was not an issue before on the same system, so I'm not sure why it's happening now.