iina / iina

The modern video player for macOS.
https://iina.io
GNU General Public License v3.0
38.11k stars 2.56k forks source link

Crash while calculating edit distance #4314

Closed low-batt closed 1 year ago

low-batt commented 1 year ago

System and IINA version:

Expected behavior: IINA does not crash.

Actual behavior: The IINAPlayerCoreTask thread crashed in ObjcUtils.levDistance called from the forceMatchUnmatchedVideos method in AutoFileMatcher at line 299:

let threshold = UInt(Double(video.filename.count + sub.filename.count) * 0.6)
let rawDist = ObjcUtils.levDistance(video.prefix, and: sub.prefix) + ObjcUtils.levDistance(video.suffix, and: sub.suffix)
Crash report: ```text ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Process: IINA [8516] Path: /Users/USER/Library/Developer/Xcode/DerivedData/iina-gwhhvjgxybcchtdcwvmukizbfeip/Build/Products/Debug/IINA.app/Contents/MacOS/IINA Identifier: com.colliderli.iina Version: 1.3.1 (133) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 503 Date/Time: 2023-04-01 16:25:04.3932 -0400 OS Version: macOS 13.3 (22E252) Report Version: 12 Anonymous UUID: C8F97525-3322-572C-B9CE-A91EB243AC3C Sleep/Wake UUID: 2D072A3C-8B2A-4071-A6BE-46BB0F1B403F Time Awake Since Boot: 61000 seconds Time Since Wake: 335 seconds System Integrity Protection: enabled Crashed Thread: 7 Dispatch queue: IINAPlayerCoreTask Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x000000016b8b4000 Exception Codes: 0x0000000000000002, 0x000000016b8b4000 Termination Reason: Namespace SIGNAL, Code 10 Bus error: 10 Terminating Process: exc handler [8516] VM Region Info: 0x16b8b4000 is in 0x16b8b4000-0x16b8b8000; bytes after start: 0 bytes before end: 16383 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL Stack 16b82c000-16b8b4000 [ 544K] rw-/rwx SM=PRV thread 7 ---> Stack Guard 16b8b4000-16b8b8000 [ 16K] ---/rwx SM=NUL Stack 16b8b8000-16b940000 [ 544K] rw-/rwx SM=PRV Thread 0:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x184c4bf14 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x184c5e240 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x184c54b78 mach_msg_overwrite + 604 3 libsystem_kernel.dylib 0x184c4c290 mach_msg + 24 4 CoreFoundation 0x184d6a8b8 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x184d69198 __CFRunLoopRun + 1208 6 CoreFoundation 0x184d6858c CFRunLoopRunSpecific + 612 7 HIToolbox 0x18e59ddf4 RunCurrentEventLoopInMode + 292 8 HIToolbox 0x18e59dc30 ReceiveNextEventCommon + 648 9 HIToolbox 0x18e59d988 _BlockUntilNextEventMatchingListInModeWithFilter + 76 10 AppKit 0x187f87f58 _DPSNextEvent + 636 11 AppKit 0x187f870f4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716 12 AppKit 0x187f7b558 -[NSApplication run] + 464 13 AppKit 0x187f529a8 NSApplicationMain + 880 14 IINA 0x104ab9a30 main + 12 (AppDelegate.swift:24) 15 dyld 0x184933f28 start + 2236 Thread 1: 0 libsystem_pthread.dylib 0x184c86d8c start_wqthread + 0 Thread 2:: Dispatch queue: IINAHistoryController 0 CoreFoundation 0x184d10ef8 CFDictionaryAddValue + 12 1 CoreFoundation 0x184d407e8 _flattenPlist + 308 2 CoreFoundation 0x184d4094c _flattenPlist + 664 3 CoreFoundation 0x184d409b0 _flattenPlist + 764 4 CoreFoundation 0x184d4094c _flattenPlist + 664 5 CoreFoundation 0x184d400f0 __CFBinaryPlistWriteOrPresize + 320 6 Foundation 0x185ccf148 -[NSKeyedArchiver finishEncoding] + 636 7 Foundation 0x185d90404 +[NSKeyedArchiver archiveRootObject:toFile:] + 224 8 IINA 0x104af11e0 HistoryController.save() + 420 (HistoryController.swift:31) 9 IINA 0x104af17c8 HistoryController.add(_:duration:) + 1180 (HistoryController.swift:44) 10 IINA 0x104caec88 closure #2 in PlayerCore.fileLoaded() + 116 (PlayerCore.swift:1458) 11 IINA 0x1048c0a50 thunk for @escaping @callee_guaranteed () -> () + 48 12 libdispatch.dylib 0x184ada874 _dispatch_call_block_and_release + 32 13 libdispatch.dylib 0x184adc400 _dispatch_client_callout + 20 14 libdispatch.dylib 0x184ae3a88 _dispatch_lane_serial_drain + 668 15 libdispatch.dylib 0x184ae45f8 _dispatch_lane_invoke + 384 16 libdispatch.dylib 0x184aef244 _dispatch_workloop_worker_thread + 648 17 libsystem_pthread.dylib 0x184c88074 _pthread_wqthread + 288 18 libsystem_pthread.dylib 0x184c86d94 start_wqthread + 8 Thread 3: 0 libsystem_pthread.dylib 0x184c86d8c start_wqthread + 0 Thread 4: 0 libsystem_pthread.dylib 0x184c86d8c start_wqthread + 0 Thread 5: 0 libsystem_pthread.dylib 0x184c86d8c start_wqthread + 0 Thread 6: 0 libsystem_pthread.dylib 0x184c86d8c start_wqthread + 0 Thread 7 Crashed:: Dispatch queue: IINAPlayerCoreTask 0 libsystem_platform.dylib 0x184cba474 _platform_memset + 164 1 IINA 0x10489977c +[ObjcUtils levDistance:and:] + 388 (ObjcUtils.m:60) 2 IINA 0x1049ac180 AutoFileMatcher.forceMatchUnmatchedVideos() + 2552 (AutoFileMatcher.swift:299) 3 IINA 0x1049ae2c8 AutoFileMatcher.startMatching() + 4124 (AutoFileMatcher.swift:359) 4 IINA 0x104cb0da0 PlayerCore.autoLoadFilesInCurrentFolder(ticket:) + 92 (PlayerCore.swift:1551) 5 IINA 0x104cac75c closure #3 in PlayerCore.fileStarted(path:) + 488 (PlayerCore.swift:1391) 6 IINA 0x1048c0a50 thunk for @escaping @callee_guaranteed () -> () + 48 7 libdispatch.dylib 0x184ada874 _dispatch_call_block_and_release + 32 8 libdispatch.dylib 0x184adc400 _dispatch_client_callout + 20 9 libdispatch.dylib 0x184ae3a88 _dispatch_lane_serial_drain + 668 10 libdispatch.dylib 0x184ae45f8 _dispatch_lane_invoke + 384 11 libdispatch.dylib 0x184aef244 _dispatch_workloop_worker_thread + 648 12 libsystem_pthread.dylib 0x184c88074 _pthread_wqthread + 288 13 libsystem_pthread.dylib 0x184c86d94 start_wqthread + 8 Thread 8:: Dispatch queue: com.colliderli.iina.controller 0 libsystem_kernel.dylib 0x184c4ebc8 __psynch_mutexwait + 8 1 libsystem_pthread.dylib 0x184c890c4 _pthread_mutex_firstfit_lock_wait + 84 2 libsystem_pthread.dylib 0x184c86a5c _pthread_mutex_firstfit_lock_slow + 248 3 libsystem_pthread.dylib 0x184c8c600 _pthread_cond_wait + 1372 4 CoreAudio 0x1872c5150 HALB_Guard::WaitFor(unsigned long long) + 232 5 CoreAudio 0x1870c443c HALB_IOThread::_WaitForState(unsigned int) + 272 6 CoreAudio 0x1870c491c HALB_IOThread::StartAndWaitForState(unsigned int) + 516 7 CoreAudio 0x186f66314 HALC_ProxyIOContext::_StartIO() + 300 8 CoreAudio 0x186f2cef8 HAL_HardwarePlugIn_DeviceStart(AudioHardwarePlugInInterface**, unsigned int, int (*)(unsigned int, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*)) + 1012 9 CoreAudio 0x186d8fe9c AudioDeviceStart + 248 10 CoreAudio 0x12f9d4aa4 0x12f9c8000 + 51876 11 CoreAudio 0x12f9d4888 0x12f9c8000 + 51336 12 CoreAudio 0x12fad1da8 0x12f9c8000 + 1088936 13 AudioToolboxCore 0x186af7fe4 AudioOutputUnitStart + 316 14 libmpv.1.dylib 0x106093aec start + 28 15 libmpv.1.dylib 0x106098b38 ao_set_paused + 280 16 libmpv.1.dylib 0x10610cf34 set_pause_state + 88 17 libmpv.1.dylib 0x1060f39dc mp_option_change_callback + 616 18 libmpv.1.dylib 0x1060da448 m_config_set_option_raw + 356 19 libmpv.1.dylib 0x1060f350c mp_property_generic_option + 160 20 libmpv.1.dylib 0x1060e68b0 m_property_do + 4284 21 libmpv.1.dylib 0x1060ef7b8 mp_property_do + 76 22 libmpv.1.dylib 0x1060ed1bc setproperty_fn + 116 23 libmpv.1.dylib 0x1060ed0d8 mpv_set_property + 92 24 IINA 0x104cf2650 MPVController.setFlag(_:_:) + 600 (MPVController.swift:538) 25 IINA 0x104cfd128 MPVController.onFileLoaded() + 1700 (MPVController.swift:981) 26 IINA 0x104cfa818 MPVController.handleEvent(_:) + 7192 (MPVController.swift:869) 27 IINA 0x104cf89b4 closure #1 in MPVController.readEvents() + 520 (MPVController.swift:776) 28 IINA 0x1048c0a50 thunk for @escaping @callee_guaranteed () -> () + 48 29 libdispatch.dylib 0x184ada874 _dispatch_call_block_and_release + 32 30 libdispatch.dylib 0x184adc400 _dispatch_client_callout + 20 31 libdispatch.dylib 0x184ae3a88 _dispatch_lane_serial_drain + 668 32 libdispatch.dylib 0x184ae45f8 _dispatch_lane_invoke + 384 33 libdispatch.dylib 0x184aef244 _dispatch_workloop_worker_thread + 648 34 libsystem_pthread.dylib 0x184c88074 _pthread_wqthread + 288 35 libsystem_pthread.dylib 0x184c86d94 start_wqthread + 8 Thread 9: 0 libsystem_pthread.dylib 0x184c86d8c start_wqthread + 0 Thread 10: 0 libsystem_pthread.dylib 0x184c86d8c start_wqthread + 0 Thread 11:: */mpv core 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x1060d5a34 mp_dispatch_queue_process + 140 3 libmpv.1.dylib 0x10610cca8 mp_wait_events + 80 4 libmpv.1.dylib 0x10610edf0 run_playloop + 2344 5 libmpv.1.dylib 0x106105c4c mp_play_files + 6628 6 libmpv.1.dylib 0x1060ebf1c core_thread + 72 7 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 8 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 12:: */log-file 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x10609eb38 log_file_thread + 120 3 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 4 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 13:: */lua script (ytdl_hook) 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x1060eb7b4 wait_wakeup + 88 3 libmpv.1.dylib 0x1060ec11c mpv_wait_event + 420 4 libmpv.1.dylib 0x106107970 script_raw_wait_event + 120 5 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 6 libluajit-5.1.2.dylib 0x106517490 lua_pcall + 148 7 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 8 libmpv.1.dylib 0x106107444 load_scripts + 376 9 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 10 libluajit-5.1.2.dylib 0x106517490 lua_pcall + 148 11 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 12 libluajit-5.1.2.dylib 0x1065174d0 lua_cpcall + 28 13 libmpv.1.dylib 0x1061116a4 run_script + 100 14 libmpv.1.dylib 0x106111728 script_thread + 32 15 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 16 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 14:: */lua script (stats) 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x1060eb7b4 wait_wakeup + 88 3 libmpv.1.dylib 0x1060ec11c mpv_wait_event + 420 4 libmpv.1.dylib 0x106107970 script_raw_wait_event + 120 5 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 6 libluajit-5.1.2.dylib 0x106517490 lua_pcall + 148 7 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 8 libmpv.1.dylib 0x106107444 load_scripts + 376 9 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 10 libluajit-5.1.2.dylib 0x106517490 lua_pcall + 148 11 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 12 libluajit-5.1.2.dylib 0x1065174d0 lua_cpcall + 28 13 libmpv.1.dylib 0x1061116a4 run_script + 100 14 libmpv.1.dylib 0x106111728 script_thread + 32 15 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 16 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 15:: */lua script (console) 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x1060eb7b4 wait_wakeup + 88 3 libmpv.1.dylib 0x1060ec11c mpv_wait_event + 420 4 libmpv.1.dylib 0x106107970 script_raw_wait_event + 120 5 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 6 libluajit-5.1.2.dylib 0x106517490 lua_pcall + 148 7 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 8 libmpv.1.dylib 0x106107444 load_scripts + 376 9 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 10 libluajit-5.1.2.dylib 0x106517490 lua_pcall + 148 11 libluajit-5.1.2.dylib 0x10650a838 lj_BC_FUNCC + 44 12 libluajit-5.1.2.dylib 0x1065174d0 lua_cpcall + 28 13 libmpv.1.dylib 0x1061116a4 run_script + 100 14 libmpv.1.dylib 0x106111728 script_thread + 32 15 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 16 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 16:: */ipc socket listener 0 libsystem_kernel.dylib 0x184c54834 poll + 8 1 libmpv.1.dylib 0x1060d2f48 ipc_thread + 368 2 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 17:: caulk.messenger.shared:17 0 libsystem_kernel.dylib 0x184c4be90 semaphore_wait_trap + 8 1 caulk 0x18e2aa024 caulk::semaphore::timed_wait(double) + 212 2 caulk 0x18e2a9ed8 caulk::concurrent::details::worker_thread::run() + 36 3 caulk 0x18e2a9bc8 void* caulk::thread_proxy>>(void*) + 96 4 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 5 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 18:: com.apple.NSEventThread 0 libsystem_kernel.dylib 0x184c4bf14 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x184c5e240 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x184c54b78 mach_msg_overwrite + 604 3 libsystem_kernel.dylib 0x184c4c290 mach_msg + 24 4 CoreFoundation 0x184d6a8b8 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x184d69198 __CFRunLoopRun + 1208 6 CoreFoundation 0x184d6858c CFRunLoopRunSpecific + 612 7 AppKit 0x1880b2508 _NSEventThread + 172 8 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 9 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 19:: CVDisplayLink 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c5a0 _pthread_cond_wait + 1276 2 CoreVideo 0x18ca0ec64 CVDisplayLink::waitUntil(unsigned long long) + 324 3 CoreVideo 0x18ca0dd34 CVDisplayLink::runIOThread() + 504 4 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 5 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 20:: */demux 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x1060a4050 demux_thread + 236 3 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 4 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 21:: */worker 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x1060d74e8 worker_thread + 80 3 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 4 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 22:: */vo 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libmpv.1.dylib 0x106155268 vo_thread + 1008 3 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 4 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 23:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 24:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 25:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 26:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 27:: dav1d-frame 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc595c dav1d_frame_task + 80 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 28:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 29:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 30:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 31:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 32:: dav1d-frame 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc595c dav1d_frame_task + 80 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 33:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 34:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 35:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 36:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 37:: dav1d-frame 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc595c dav1d_frame_task + 80 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 38:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 39:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 40:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 41:: dav1d-tile 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc5a84 dav1d_tile_task + 196 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 42:: dav1d-frame 0 libsystem_kernel.dylib 0x184c4f710 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x184c8c574 _pthread_cond_wait + 1232 2 libdav1d.5.dylib 0x106cc595c dav1d_frame_task + 80 3 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 43:: com.apple.audio.IOThread.client 0 libsystem_kernel.dylib 0x184c4bf14 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x184c5e240 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x184c54b78 mach_msg_overwrite + 604 3 libsystem_kernel.dylib 0x184c4c290 mach_msg + 24 4 CoreAudio 0x186f621ec HALC_ProxyIOContext::IOWorkLoop() + 660 5 CoreAudio 0x186f6187c invocation function for block in HALC_ProxyIOContext::HALC_ProxyIOContext(unsigned int, unsigned int) + 116 6 CoreAudio 0x1870c4564 HALB_IOThread::Entry(void*) + 88 7 libsystem_pthread.dylib 0x184c8bfa8 _pthread_start + 148 8 libsystem_pthread.dylib 0x184c86da0 thread_start + 8 Thread 7 crashed with ARM Thread State (64-bit): x0: 0x000000016b8b3f6c x1: 0x0000000000000000 x2: 0xffffffffffffffe8 x3: 0x000000016b8b3fe8 x4: 0x000000016b8b3fc0 x5: 0x0000000000000010 x6: 0x000000016b93910f x7: 0x00000000000003e8 x8: 0x0000000000000004 x9: 0x000000000000002f x10: 0x000000000000002f x11: 0x000000000008ac10 x12: 0x00006000016292c0 x13: 0x000000011ff1b120 x14: 0x01000001e0100791 x15: 0x00000001e0100790 x16: 0x0000000184cba3d0 x17: 0x00000001e4c0d910 x18: 0x0000000000000000 x19: 0x000000016b939650 x20: 0x000060000022a3c0 x21: 0x0000000000000000 x22: 0x0000000000000000 x23: 0x000000016b93b0e0 x24: 0x0000600001b0df68 x25: 0x0000000000000000 x26: 0x0000000000000114 x27: 0x0000000000000000 x28: 0x00006000020f5e00 fp: 0x000000016b939640 lr: 0x000000010489977c sp: 0x000000016b8ae980 pc: 0x0000000184cba474 cpsr: 0x80001000 far: 0x000000016b8b4000 esr: 0x92000047 (Data Abort) byte write Translation fault ```


Steps to reproduce: I am not able to reproduce this crash upon demand. This crash occurred during automated testing using the script below attempting to detect race conditions during shutdown.

startQuitLoop.sh: ```bash #!/bin/bash while true; do echo Starting IINA open -a /Users/low-batt/Library/Developer/Xcode/DerivedData/iina-gwhhvjgxybcchtdcwvmukizbfeip/Build/Products/Debug/IINA.app ~/Movies/resume-failure.mp4 sleep 2 echo Instructing IINA to Quit osascript -e 'activate application "IINA"' \ -e 'tell application "System Events" to keystroke "q" using command down' sleep 2 done ```

How often does this happen? Very rarely.

low-batt commented 1 year ago

iina.log mpv.log

uiryuu commented 1 year ago

I removed the memset statement, it is unnecessary. But I don't think that will fix the crash, since we use the exact range to clear up the array using two for loops after the memset anyway. Have you met this crash multiple times? Or just one time?

low-batt commented 1 year ago

So far I have only seen this particular crash the one time. I have been doing stress testing starting and quitting IINA over and over again using a bash script. Mostly IINA is stable, but rarely this testing will generate a crash. This one is from that testing.

We still have thread data races that need to be addressed. That can cause random behavior. And of course this test is also stress testing mpv.

Once we have upgraded dependencies I will repeat this stress testing and see where we are at.

saagarjha commented 1 year ago

The bug here is that dist has overflowed the stack.