Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Crash when opening a malformed mp3 file #31

Closed
filiph opened this issue Mar 7, 2024 · 2 comments
Closed

fix: Crash when opening a malformed mp3 file #31

filiph opened this issue Mar 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@filiph
Copy link
Collaborator

filiph commented Mar 7, 2024

Description

When trying to open a bad mp3 file, the app crashes (no exception — just immediate crash).

Steps To Reproduce

  1. Create a file that's not an mp3. For example, download this PNG and rename its extension to .mp3.
  2. Open the flutter_soloud example app
  3. Switch to the 'hello world!' tab
  4. Click 'pick audio'
  5. Use the file picker to select the invalid mp3 file.
  6. Witness the crash

Expected Behavior

An exception is thrown (or some kind of FlutterErrors thing is returned).

Screenshots

Screenshot 2024-03-07 at 20 49 19

Additional Context

Full crash info

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               flutter_soloud_example [27308]
Path:                  /Users/USER/*/flutter_soloud_example.app/Contents/MacOS/flutter_soloud_example
Identifier:            com.example.flutterSoloudExample
Version:               0.1.0 (1)
Code Type:             ARM-64 (Native)
Parent Process:        dart [26964]
Responsible:           idea [96357]
User ID:               501

Date/Time:             2024-03-07 20:47:29.3176 +0100
OS Version:            macOS 14.3.1 (23D60)
Report Version:        12
Anonymous UUID:        12B4D141-C435-0024-14C4-F80661B33388

Sleep/Wake UUID:       C3A493C0-0EA1-4D0F-ACFF-74EBF4F9AC8C

Time Awake Since Boot: 280000 seconds
Time Since Wake:       236 seconds

System Integrity Protection: enabled

Crashed Thread:        1  io.flutter.ui

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000040
Exception Codes:       0x0000000000000001, 0x0000000000000040

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [27308]

VM Region Info: 0x40 is not in any region.  Bytes before following region: 4309827520
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      100e2c000-100e34000    [   32K] r-x/r-x SM=COW  ...oloud_example

Thread 0::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x18a7e1874 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x18a7f3cf0 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x18a7ea4b0 mach_msg_overwrite + 476
3   libsystem_kernel.dylib        	       0x18a7e1bf8 mach_msg + 24
4   CoreFoundation                	       0x18a8ffb84 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x18a8fe44c __CFRunLoopRun + 1208
6   CoreFoundation                	       0x18a8fd93c CFRunLoopRunSpecific + 608
7   HIToolbox                     	       0x194ec6448 RunCurrentEventLoopInMode + 292
8   HIToolbox                     	       0x194ec6284 ReceiveNextEventCommon + 648
9   HIToolbox                     	       0x194ec5fdc _BlockUntilNextEventMatchingListInModeWithFilter + 76
10  AppKit                        	       0x18e0dced0 _DPSNextEvent + 660
11  AppKit                        	       0x18e8c7eec -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
12  AppKit                        	       0x18e0d037c -[NSApplication run] + 476
13  AppKit                        	       0x18e0a7640 NSApplicationMain + 880
14  flutter_soloud_example        	       0x100e2f920 main + 12 (AppDelegate.swift:5)
15  dyld                          	       0x18a4a10e0 start + 2360

Thread 1 Crashed:: io.flutter.ui
0   flutter_soloud                	       0x101578c9c Player::setWaveformFreq(unsigned int, float)::$_4::operator()(std::__1::unique_ptr<ActiveSound, std::__1::default_delete<ActiveSound>> const&) const + 40 (player.cpp:190)
1   flutter_soloud                	       0x10152b29c std::__1::__wrap_iter<std::__1::unique_ptr<ActiveSound, std::__1::default_delete<ActiveSound>>*> std::__1::find_if[abi:v160006]<std::__1::__wrap_iter<std::__1::unique_ptr<ActiveSound, std::__1::default_delete<ActiveSound>>*>, Player::setWaveformFreq(unsigned int, float)::$_4>(std::__1::__wrap_iter<std::__1::unique_ptr<ActiveSound, std::__1::default_delete<ActiveSound>>*>, std::__1::__wrap_iter<std::__1::unique_ptr<ActiveSound, std::__1::default_delete<ActiveSound>>*>, Player::setWaveformFreq(unsigned int, float)::$_4) + 68 (find_if.h:25)
2   flutter_soloud                	       0x1015261b0 Player::setWaveformFreq(unsigned int, float) + 88 (player.cpp:188)
3   flutter_soloud                	       0x101526148 setWaveformFreq + 64 (bindings.cpp:148)
4   ???                           	       0x112b07a28 ???
5   ???                           	       0x126bc1a88 ???
6   ???                           	       0x126bc14ac ???
7   ???                           	       0x1469d2378 ???
8   ???                           	       0x1469d12e4 ???
9   ???                           	       0x125148df0 ???
10  ???                           	       0x125142eec ???
11  ???                           	       0x125142a44 ???
12  ???                           	       0x12514264c ???
13  ???                           	       0x10fae8f90 ???
14  ???                           	       0x10fae7848 ???
15  ???                           	       0x10fadc4b8 ???
16  ???                           	       0x112b0ce10 ???
17  ???                           	       0x125148df0 ???
18  ???                           	       0x125142eec ???
19  ???                           	       0x125142a44 ???
20  ???                           	       0x12514264c ???
21  ???                           	       0x10fae8f90 ???
22  ???                           	       0x10fae7848 ???
23  ???                           	       0x125141f44 ???
24  ???                           	       0x116222844 ???
25  ???                           	       0x1162223d4 ???
26  ???                           	       0x1162222cc ???
27  ???                           	       0x112b03404 ???
28  FlutterMacOS                  	       0x1051b3d68 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&) + 404
29  FlutterMacOS                  	       0x1051b4488 dart::DartEntry::InvokeCallable(dart::Thread*, dart::Function const&, dart::Array const&, dart::Array const&) + 328
30  FlutterMacOS                  	       0x1055c7420 Dart_InvokeClosure + 992
31  FlutterMacOS                  	       0x105084590 tonic::DartMicrotaskQueue::RunMicrotasks() + 164
32  FlutterMacOS                  	       0x10493c4a8 fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 296
33  FlutterMacOS                  	       0x104945724 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 52
34  CoreFoundation                	       0x18a91b9b0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
35  CoreFoundation                	       0x18a91b658 __CFRunLoopDoTimer + 972
36  CoreFoundation                	       0x18a91b190 __CFRunLoopDoTimers + 356
37  CoreFoundation                	       0x18a8fe6d4 __CFRunLoopRun + 1856
38  CoreFoundation                	       0x18a8fd93c CFRunLoopRunSpecific + 608
39  FlutterMacOS                  	       0x1049459c0 fml::MessageLoopDarwin::Run() + 188
40  FlutterMacOS                  	       0x10493c278 fml::MessageLoopImpl::DoRun() + 60
41  FlutterMacOS                  	       0x1049436a0 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0>>(void*) + 220
42  libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
43  libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 2:: io.flutter.raster
0   libsystem_kernel.dylib        	       0x18a7e1874 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x18a7f3cf0 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x18a7ea4b0 mach_msg_overwrite + 476
3   libsystem_kernel.dylib        	       0x18a7e1bf8 mach_msg + 24
4   CoreFoundation                	       0x18a8ffb84 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x18a8fe44c __CFRunLoopRun + 1208
6   CoreFoundation                	       0x18a8fd93c CFRunLoopRunSpecific + 608
7   FlutterMacOS                  	       0x1049459c0 fml::MessageLoopDarwin::Run() + 188
8   FlutterMacOS                  	       0x10493c278 fml::MessageLoopImpl::DoRun() + 60
9   FlutterMacOS                  	       0x1049436a0 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0>>(void*) + 220
10  libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
11  libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 3:: io.flutter.io
0   libsystem_kernel.dylib        	       0x18a7e1874 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x18a7f3cf0 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x18a7ea4b0 mach_msg_overwrite + 476
3   libsystem_kernel.dylib        	       0x18a7e1bf8 mach_msg + 24
4   CoreFoundation                	       0x18a8ffb84 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x18a8fe44c __CFRunLoopRun + 1208
6   CoreFoundation                	       0x18a8fd93c CFRunLoopRunSpecific + 608
7   FlutterMacOS                  	       0x1049459c0 fml::MessageLoopDarwin::Run() + 188
8   FlutterMacOS                  	       0x10493c278 fml::MessageLoopImpl::DoRun() + 60
9   FlutterMacOS                  	       0x1049436a0 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::Thread::Thread(std::_fl::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0>>(void*) + 220
10  libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
11  libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 4:: io.worker.1
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 5:: io.worker.2
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 6:: io.worker.3
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 7:: io.worker.4
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 8:: io.worker.5
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 9:: io.worker.6
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 10:: io.worker.7
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 11:: io.worker.8
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x104905448 std::_fl::condition_variable::wait(std::_fl::unique_lock<std::_fl::mutex>&) + 44
3   FlutterMacOS                  	       0x104936d6c fml::ConcurrentMessageLoop::WorkerMain() + 148
4   FlutterMacOS                  	       0x104937a38 void* std::_fl::__thread_proxy[abi:v15000]<std::_fl::tuple<std::_fl::unique_ptr<std::_fl::__thread_struct, std::_fl::default_delete<std::_fl::__thread_struct>>, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0>>(void*) + 176
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 12:: dart:io EventHandler
0   libsystem_kernel.dylib        	       0x18a7e79c0 kevent + 8
1   FlutterMacOS                  	       0x1050e07f8 dart::bin::EventHandlerImplementation::EventHandlerEntry(unsigned long) + 300
2   FlutterMacOS                  	       0x105107eac dart::bin::ThreadStart(void*) + 88
3   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
4   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 13:: Dart Profiler ThreadInterrupter
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x10534271c dart::ThreadInterrupter::ThreadMain(unsigned long) + 364
4   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 14:: Dart Profiler SampleBlockProcessor
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x1052c6428 dart::SampleBlockProcessor::ThreadMain(unsigned long) + 284
4   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 15:: DartWorker
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x1051d4af8 dart::MutatorThreadPool::OnEnterIdleLocked(dart::MonitorLocker*) + 156
4   FlutterMacOS                  	       0x10534367c dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) + 152
5   FlutterMacOS                  	       0x1053439c0 dart::ThreadPool::Worker::Main(unsigned long) + 136
6   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
7   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 16:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	       0x18a7e1874 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x18a7f3cf0 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x18a7ea4b0 mach_msg_overwrite + 476
3   libsystem_kernel.dylib        	       0x18a7e1bf8 mach_msg + 24
4   CoreFoundation                	       0x18a8ffb84 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x18a8fe44c __CFRunLoopRun + 1208
6   CoreFoundation                	       0x18a8fd93c CFRunLoopRunSpecific + 608
7   AppKit                        	       0x18e206160 _NSEventThread + 144
8   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
9   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 17:: caulk.messenger.shared:17
0   libsystem_kernel.dylib        	       0x18a7e17f0 semaphore_wait_trap + 8
1   caulk                         	       0x194bc2690 caulk::semaphore::timed_wait(double) + 212
2   caulk                         	       0x194bc2544 caulk::concurrent::details::worker_thread::run() + 36
3   caulk                         	       0x194bc2244 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*>>>(void*) + 96
4   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
5   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 18:: caulk.messenger.shared:high
0   libsystem_kernel.dylib        	       0x18a7e17f0 semaphore_wait_trap + 8
1   caulk                         	       0x194bc2690 caulk::semaphore::timed_wait(double) + 212
2   caulk                         	       0x194bc2544 caulk::concurrent::details::worker_thread::run() + 36
3   caulk                         	       0x194bc2244 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*>>>(void*) + 96
4   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
5   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 19:: caulk::deferred_logger
0   libsystem_kernel.dylib        	       0x18a7e17f0 semaphore_wait_trap + 8
1   caulk                         	       0x194bc2690 caulk::semaphore::timed_wait(double) + 212
2   caulk                         	       0x194bc2544 caulk::concurrent::details::worker_thread::run() + 36
3   caulk                         	       0x194bc2244 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*>>>(void*) + 96
4   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
5   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 20:: DartWorker
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x1051d4af8 dart::MutatorThreadPool::OnEnterIdleLocked(dart::MonitorLocker*) + 156
4   FlutterMacOS                  	       0x10534367c dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) + 152
5   FlutterMacOS                  	       0x1053439c0 dart::ThreadPool::Worker::Main(unsigned long) + 136
6   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
7   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 21:: dart:io Process.start
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a8225fc _pthread_cond_wait + 1228
2   FlutterMacOS                  	       0x105108658 dart::bin::Monitor::WaitMicros(long long) + 152
3   FlutterMacOS                  	       0x1050e9130 dart::bin::ExitCodeHandler::ExitCodeHandlerEntry(unsigned long) + 132
4   FlutterMacOS                  	       0x105107eac dart::bin::ThreadStart(void*) + 88
5   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
6   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 22:
0   libsystem_pthread.dylib       	       0x18a81ce28 start_wqthread + 0

Thread 23:
0   libsystem_pthread.dylib       	       0x18a81ce28 start_wqthread + 0

Thread 24:
0   libsystem_pthread.dylib       	       0x18a81ce28 start_wqthread + 0

Thread 25:: DartWorker
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x1053437dc dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) + 504
4   FlutterMacOS                  	       0x1053439c0 dart::ThreadPool::Worker::Main(unsigned long) + 136
5   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
6   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
7   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 26:: DartWorker
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x1053437dc dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) + 504
4   FlutterMacOS                  	       0x1053439c0 dart::ThreadPool::Worker::Main(unsigned long) + 136
5   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
6   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
7   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 27:: DartWorker
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x1051d4af8 dart::MutatorThreadPool::OnEnterIdleLocked(dart::MonitorLocker*) + 156
4   FlutterMacOS                  	       0x10534367c dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) + 152
5   FlutterMacOS                  	       0x1053439c0 dart::ThreadPool::Worker::Main(unsigned long) + 136
6   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
7   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 28:: DartWorker
0   libsystem_kernel.dylib        	       0x18a7e506c __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18a822628 _pthread_cond_wait + 1272
2   FlutterMacOS                  	       0x1052c0e80 dart::Monitor::WaitMicros(long long) + 128
3   FlutterMacOS                  	       0x1051d4af8 dart::MutatorThreadPool::OnEnterIdleLocked(dart::MonitorLocker*) + 156
4   FlutterMacOS                  	       0x10534367c dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) + 152
5   FlutterMacOS                  	       0x1053439c0 dart::ThreadPool::Worker::Main(unsigned long) + 136
6   FlutterMacOS                  	       0x1052c0280 dart::ThreadStart(void*) + 204
7   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
8   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8

Thread 29:: com.apple.audio.IOThread.client
0   libsystem_kernel.dylib        	       0x18a7e1874 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x18a7f3cf0 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x18a7ea4b0 mach_msg_overwrite + 476
3   libsystem_kernel.dylib        	       0x18a7e1bf8 mach_msg + 24
4   CoreAudio                     	       0x18d16d860 HALB_MachPort::SendSimpleMessageWithSimpleReply(unsigned int, unsigned int, int, int&, bool, unsigned int) + 96
5   CoreAudio                     	       0x18d0443c4 HALC_ProxyIOContext::IOWorkLoop() + 4260
6   CoreAudio                     	       0x18d042bf0 invocation function for block in HALC_ProxyIOContext::HALC_ProxyIOContext(unsigned int, unsigned int) + 108
7   CoreAudio                     	       0x18d1c1f2c HALC_IOThread::Entry(void*) + 88
8   libsystem_pthread.dylib       	       0x18a822034 _pthread_start + 136
9   libsystem_pthread.dylib       	       0x18a81ce3c thread_start + 8


Thread 1 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000600000455308   x2: 0x000000016f315474   x3: 0x000000005ad3bab5
    x4: 0x0000000112a8b7e1   x5: 0x0000000000000000   x6: 0x00000001215153c1   x7: 0x0000000000000001
    x8: 0x000000016f3153f0   x9: 0x000000016f3153f0  x10: 0x0000000000000005  x11: 0x00001b0000001b02
   x12: 0x0000000000001c00  x13: 0x0000070000000700  x14: 0x0000000000000000  x15: 0x000000016f3154b0
   x16: 0x0000000000000000  x17: 0x000000017c80d760  x18: 0x0000000000000000  x19: 0x0000000126bc1a94
   x20: 0x00000001428690b8  x21: 0x000000017c80d000  x22: 0x0000000112a88081  x23: 0x0000000106df20c8
   x24: 0x0000000112a88081  x25: 0x000000016f2b3000  x26: 0x000000017c80d000  x27: 0x0000000124c18680
   x28: 0x0000000800000000   fp: 0x000000016f3153e0   lr: 0x0000000101578c98
    sp: 0x000000016f3153c0   pc: 0x0000000101578c9c cpsr: 0x80001000
   far: 0x0000000000000040  esr: 0x92000006 (Data Abort) byte read Translation fault

...
@filiph filiph added the bug Something isn't working label Mar 7, 2024
@alnitak
Copy link
Owner

alnitak commented Mar 8, 2024

This seems to be related to the StreamController I wrongly used here
When you switch from "waveforms" tab to the "Hello World!", that stream is still active and when it receives a new event, it will try to call SoloudTools.initSounds() which throws that exception!
If you start with the "Hello World!" (initialIndex: 0), this doesn't happen.

So, there are 2 fixes to think about:

  • check if the engine is started in SoloudTools.initSounds()
  • find a better way to expose SoLoud().audioEvent stream. Now it is set as a broadcast inside a singleton class. Is it worth considering moving the event stream flow to a dedicated class? Now the developer can subscribe to it (like I did wrongly) and then he needs to remove that subscription, which is not possible IIRC with a broadcast.

For now I will correct the error in the example, then maybe we should open a new issue

@filiph
Copy link
Collaborator Author

filiph commented Mar 8, 2024

FWIW, I think you can cancel a broadcast stream subscription. But yeah, broadcast streams are a bit of a minefield.

I'll open a new issue that addresses the audioEvent / singleton issue more generally.

Here, apart from fixing the bug in the example, I'd like to make sure that if such a problem is encountered, we don't crash. Not from C++ land. I'd just throw a (Dart) exception instead, or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants