Tau: [BUG] Crash when "hot restart" (with crash report & cause of it)

Created on 8 Jun 2020  路  8Comments  路  Source: Canardoux/tau

When running the sample app and click "hot restart", the app crashes (iOS emulator and iOS device).

The crash report says


Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
Assertion failed: (flautoPlayerSlots[slotNo] == [NSNull null]), function -[FlautoPlayerManager handleMethodCall:result:], file /Users/tom/RefCode/flutter_sound-4/ios/Classes/FlutterSoundPlayer.m, line 104.

CoreSimulator 704.12.2 - Device: iPhone SE (2nd generation) (9FF71C9F-9919-4E46-BF44-4292C0AB5C10) - Runtime: iOS 13.5 (17F61) - DeviceType: iPhone SE (2nd generation)

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff51b617fa __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff51c0cbc1 pthread_kill + 432
2 libsystem_c.dylib 0x00007fff51af0b7c abort + 120
3 libsystem_c.dylib 0x00007fff51aefe36 __assert_rtn + 314
4 com.dooboolab.FlutterSoundDemo 0x0000000104d02134 -[FlautoPlayerManager handleMethodCall:result:] + 788
5 io.flutter.flutter 0x0000000106a889df __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
6 io.flutter.flutter 0x0000000106a17622 flutter::PlatformMessageRouter::HandlePlatformMessage(fml::RefPtr) const + 166
7 io.flutter.flutter 0x0000000106a1b77a flutter::PlatformViewIOS::HandlePlatformMessage(fml::RefPtr) + 38
8 io.flutter.flutter 0x0000000106a826bb std::__1::__function::__func)::$_32, std::__1::allocator)::$_32>, void ()>::operator()() + 57
9 io.flutter.flutter 0x0000000106a2c267 fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 117
10 io.flutter.flutter 0x0000000106a311b4 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer, fml::MessageLoopDarwin) + 26
11 com.apple.CoreFoundation 0x00007fff23da14b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
12 com.apple.CoreFoundation 0x00007fff23da114e __CFRunLoopDoTimer + 1038
13 com.apple.CoreFoundation 0x00007fff23da07aa __CFRunLoopDoTimers + 282
14 com.apple.CoreFoundation 0x00007fff23d9b3fe __CFRunLoopRun + 1950
15 com.apple.CoreFoundation 0x00007fff23d9a944 CFRunLoopRunSpecific + 404
16 com.apple.GeoServices 0x00007fff38ba6c1a GSEventRunModal + 139
17 com.apple.UIKitCore 0x00007fff48c8b9ec UIApplicationMain + 1605
18 com.dooboolab.FlutterSoundDemo 0x0000000104cfd4db main + 75 (AppDelegate.swift:5)
19 libdyld.dylib 0x00007fff51a231fd start + 1

so the most important line is :

Application Specific Information:
Assertion failed: (flautoPlayerSlots[slotNo] == [NSNull null]), function -[FlautoPlayerManager handleMethodCall:result:], file /Users/tom/RefCode/flutter_sound-4/ios/Classes/FlutterSoundPlayer.m, line 104.

maybe caused by the resource not get freed when hot restarting.

bug duplicate Done

Most helpful comment

I have a similar problem. If I open an AudioSession in my app at start (for example to start recordings) and then hot restart the app, the app crashes when I try to open an AudioSession again. Unfortunately I have not found a way to kill the old AudioSession. Because after the hot restart flutter_sound has no open audio session anymore. But on native iOS the AudioSession is still running.

All 8 comments

See #304

Thanks! Do I need to close this issue and discuss there?

No, keep this issue open until someone will fix that.

OK get it

I have a similar problem. If I open an AudioSession in my app at start (for example to start recordings) and then hot restart the app, the app crashes when I try to open an AudioSession again. Unfortunately I have not found a way to kill the old AudioSession. Because after the hot restart flutter_sound has no open audio session anymore. But on native iOS the AudioSession is still running.

I got the same problem and here is the error:

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar
{
        FlutterMethodChannel* aChannel = [FlutterMethodChannel methodChannelWithName:@"com.dooboolab.flutter_sound_player"
                                        binaryMessenger:[registrar messenger]];
        assert (flautoPlayerManager == nil);
        flautoPlayerManager = [[FlautoPlayerManager alloc] init];
        flautoPlayerManager ->channel = aChannel;
        [registrar addMethodCallDelegate:flautoPlayerManager channel: aChannel];
}

My version is flutter_sound: 5.0.1

Duplicate [#543]

Fixed in Flutter Sound release 7.6.3

Was this page helpful?
0 / 5 - 0 ratings