shinchiro/mpv-winbuild-cmake

mpv crashes on exit when using gcc build or self-compiled clang build

Closed this issue · 3 comments

This is a very weird issue.

When running the provided clang builds (nonv3 or v3) everything is fine, however using the gcc build mpv crashes on exit. This can be seen on a crashdump being created. (C:\Users\user\AppData\Local\CrashDumps)

The issue however also occurs when selfcompiling a clang build with this repo. The compiled build also crashed on exit.

At first, I thought that it was caused due to a recent commit made (even though I had/have no idea why it would have caused this behavior) mpv-player/mpv#13547 but also earlier builds show the issue.

I now guess something is wrong with the compiler. In the linked mpv issue you can find the crashdump. All created crashdumps (provided gcc or my self-compiled clang builds) show the exact same output.

FILE_IN_CAB:  mpv.exe.16268.dmp

NTGLOBALFLAG:  0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

CONTEXT:  (.ecxr)
rax=000001b3e50be660 rbx=0000000000000002 rcx=000001b3ddd99ce0
rdx=0000000000000002 rsi=000001b3dd881670 rdi=000001b3ddf91500
rip=00007ff675bb178f rsp=00000054444ff660 rbp=0000000000000000
 r8=0000000000000000  r9=000001b3e50be650 r10=0000000000000002
r11=0000000000000000 r12=000000027538c0a8 r13=000001b3dd815cf0
r14=000001b3dd881050 r15=0000000000000001
iopl=0         nv up ei pl nz na pe nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010202
mpv!pl_vulkan_swapchain_suboptimal+0x1113f:
00007ff6`75bb178f 803a00          cmp     byte ptr [rdx],0 ds:00000000`00000002=??
Resetting default scope

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ff675bb178f (mpv!pl_vulkan_swapchain_suboptimal+0x000000000001113f)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 0000000000000000
   Parameter[1]: 0000000000000002
Attempt to read from address 0000000000000002

PROCESS_NAME:  mpv.exe

READ_ADDRESS:  0000000000000002 

ERROR_CODE: (NTSTATUS) 0xc0000005 - Die Anweisung in 0x%p verwies auf Arbeitsspeicher bei 0x%p. Der Vorgang %s konnte im Arbeitsspeicher nicht durchgef hrt werden.

EXCEPTION_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  0000000000000000

EXCEPTION_PARAMETER2:  0000000000000002

STACK_TEXT:  
00000054`444ff660 00007ff6`7a9c81de     : 000001b3`ddf91500 00007ff8`8ac0abfe 000001b3`00000001 000001b3`db610000 : mpv!pl_vulkan_swapchain_suboptimal+0x1113f
00000054`444ff800 00007ff6`7a9c3994     : 000001b3`e89fbc70 00007ff6`00000000 000001b3`dd815cf0 00007ff8`87f937eb : mpv!mpv_render_context_get_info+0x16e9e
00000054`444ff8f0 00007ff6`7a9ad388     : 000001b3`00000000 000001b3`00000000 000001b3`dd815cf0 000001b3`dd82c1b0 : mpv!mpv_render_context_get_info+0x12654
00000054`444ff940 00007ff8`87fa9363     : 000001b3`db855330 00000000`00000000 00000000`00000000 00000000`00000000 : mpv!mpv_stream_cb_add_ro+0x8c368
00000054`444ffb60 00007ff8`8a0d257d     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ucrtbase!thread_start<unsigned int (__cdecl*)(void *),1>+0x93
00000054`444ffb90 00007ff8`8ac2aa58     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x1d
00000054`444ffbc0 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x28


STACK_COMMAND:  ~4s; .ecxr ; kb

SYMBOL_NAME:  mpv+1113f

MODULE_NAME: mpv

IMAGE_NAME:  mpv.exe

FAILURE_BUCKET_ID:  NULL_CLASS_PTR_READ_c0000005_mpv.exe!Unknown

OS_VERSION:  10.0.22621.1

BUILDLAB_STR:  ni_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

IMAGE_VERSION:  2.0.0.0

FAILURE_ID_HASH:  {e65cc2cb-4a53-04b4-f395-b66a454a0566}

Followup:     MachineOwner
---------

I thought it might be due to the Vulkan header revert - the coincidence would have been too perfect - last working gcc build mpv-x86_64-gcc-20240223-git-ae1a4ed (at this time the header revert wasn´t committed) and the first broken build mpv-x86_64-gcc-20240224-git-7454edc (header revert committed) - but even with the header back at 1.3.276, the issue persists...

Any thoughts on this?

I´m currently compiling a gcc build on my end...

Okay, so I compiled mpv with gcc, while doing so some commits have been made to mpv master - now the issue is gone with gcc and clang...

I guess the commit mpv-player/mpv@6ecdeda has fixed it. I will do some further testing and report back (=and will close this issue)

I had the exact same problem, also solved by that commit in mpv 👍

Did some further testing, the issue was introduced by commit mpv-player/mpv@8401595 and fixed by mpv-player/mpv@6ecdeda.

Closing this.