norihiro / obs-face-tracker

Face tracking plugin for OBS Studio
GNU General Public License v2.0
343 stars 29 forks source link

Crash after starting correlation tracker #159

Open norihiro opened 1 week ago

norihiro commented 1 week ago

Source/filter types

Version: 0.7.2

Describe the bug A user reported a crash in the correlation-tracker thread on Windows. I can reproduce the issue using 0.7.2.

OBS 30.1.2 log file uploaded at 2024-06-28, 05:16:57

Unhandled exception: c0000005
Date/Time: 2024-06-28, 05:16:18
Fault address: 7FF836D13028 (c:\windows\system32\msvcp140.dll)
libobs version: 30.1.2 (64-bit)
Windows version: 10.0 build 22631 (release: 23H2; revision: 3737; 64-bit)
CPU: AMD Ryzen 5 5600 6-Core Processor              

Thread 54F4: face-trk (Crashed)
Stack            EIP              Arg0             Arg1             Arg2             Arg3             Address
000000AC4CDFF250 00007FF836D13028 000002A64BB4C9A0 000002A5FBE445E8 000002A64BB4C9A0 0000000000000000 msvcp140.dll!0x7ff836d13028
000000AC4CDFF2B0 00007FFFAE2CAC7D 4068E00000000000 000002A6527C7020 000000AC4CDFF580 0000000000000000 obs-face-tracker.dll!dlib::kiss_details::get_plan<dlib::kiss_details::kiss_fftnd_state<double> >+0x6d
000000AC4CDFF360 00007FFFAE2CC1C8 000002A6527C7020 C04995F15F15F15F 0000597C013D4540 0000000000000000 obs-face-tracker.dll!dlib::kiss_fft<double>+0xb8
000000AC4CDFF410 00007FFFAE2A026C 0000000000000003 00007FF85394D7B9 0000000000040048 0000000000000190 obs-face-tracker.dll!dlib::fft_inplace<double,0,0,dlib::memory_manager_stateless_kernel_1<char>,dlib::row_major_layout>+0x9c
000000AC4CDFF480 00007FFFAE2AAE1D 000002A5DCAFA040 000002A5C7D5DB98 0000000000000000 000002A5C7D5DB98 obs-face-tracker.dll!dlib::correlation_tracker::start_track<dlib::matrix<dlib::rgb_pixel,0,0,dlib::memory_manager_stateless_kernel_1<char>,dlib::row_major_layout> >+0x12d
000000AC4CDFF700 00007FFFAE2BA9D6 000002A5EAA271C0 000002A5C7D5DB60 0000000000000000 0000000000000000 obs-face-tracker.dll!face_tracker_dlib::track_main+0x1b6
000000AC4CDFF890 00007FFFAE299208 000002A5C7D5DB60 000002A5C7D5DB78 000002A5C7D5DB78 0000000000000000 obs-face-tracker.dll!face_tracker_base::thread_routine+0x68
000000AC4CDFF8D0 00007FF8276D1354 000002A6737CD590 0000000000000000 0000000000000000 0000000000000000 w32-pthreads.dll!ptw32_threadStart+0x74
000000AC4CDFF950 00007FF851379333 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ucrtbase.dll!0x7ff851379333
000000AC4CDFF980 00007FF85169257D 0000000000000000 0000000000000000 0000000000000000 0000000000000000 kernel32.dll!0x7ff85169257d
000000AC4CDFF9B0 00007FF85396AF28 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ntdll.dll!0x7ff85396af28

To Reproduce

Steps to reproduce the behavior:

  1. Apply Face Tracker filter to a camera source. Settings are all default.
  2. Ensure the face is detected. Then, OBS will crash.

Desktop (please complete the following information):

Additional context

Using the first run of the build flow of the commit 275d2bf, it didn't crash. Using the second run of the build flow of the same commit, it crashed. Major difference of these two flows are the version of VC.

-C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\CL.exe
+C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\CL.exe

The crashing code in dlib is as below. https://github.com/norihiro/dlib/blob/3ecec8a4d317ec4f34dfebad5035c5ad48a5f29d/dlib/fft/kiss_fft.h#L596-L614

Briefly looking at the code in dlib, I cannot find any suspicious code. I'm suspecting something is wrong with the STL from Microsoft.

norihiro commented 1 day ago

The issue happens when user's VC 2022 redistributable DLL is older. Details are described in https://github.com/actions/runner-images/issues/10020.