shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
1.97k stars 118 forks source link

fix: After patching iOS, the app crashes on startup. #1957

Closed sssolinjie closed 3 weeks ago

sssolinjie commented 3 weeks ago

App ID: de3c0af9-b1df-4a3c-9694-5400674772ce

Description

After applying an iOS patch, the app crashes on startup and can only be opened after trying 4-5 times.

eseidel commented 3 weeks ago

Crashes are definitely unexpected. Are you able to share a crash report? We would love to help!

On Mon, Apr 22, 2024 at 6:49 PM sssolinjie @.***> wrote:

App ID: de3c0af9-b1df-4a3c-9694-5400674772ce

Description

After applying an iOS patch, the app crashes on startup and can only be opened after trying 4-5 times.

— Reply to this email directly, view it on GitHub https://github.com/shorebirdtech/shorebird/issues/1957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADU2TMGGMYUH42FS45WR7TY6W42ZAVCNFSM6AAAAABGT2ZVYKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TONZVHA2TIMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sssolinjie commented 3 weeks ago

@eseidel
I was building iOS using Flutter 3.19.2. Later, Flutter upgraded to 3.19.5, and shorebird upgraded to 1.0.2. After releasing patches, crashes occurred, and I do not know how to roll back shorebird to the previous version. image

felangel commented 3 weeks ago

@eseidel I was building iOS using Flutter 3.19.2. Later, Flutter upgraded to 3.19.5, and shorebird upgraded to 1.0.2. After releasing patches, crashes occurred, and I do not know how to roll back shorebird to the previous version. image

Can you please share the crash report with us? We’d love to help, thanks!

eseidel commented 3 weeks ago

We're also reachable at contact@shorebird.dev and on Discord: https://discord.gg/shorebird. We take any potential crashers very seriously and would love to help. Thank you!

ismail-mufin commented 3 weeks ago

@eseidel @felangel After sending the patch iOS yesterday, we also experienced crash on startup. It was coming from the version package and was stuck on the splash screen. Have you made any changes that interfere with the version number?

FlutterError - FormatException: Not a properly formatted version string. Error thrown .

Fatal Exception: FlutterError
0  ???                            0x0 Version.parse (version.dart)
1  ???                            0x0 Upgrader.isUpdateAvailable + 530 (upgrader.dart:530)
2  ???                            0x0 Upgrader.shouldDisplayUpgrade + 442 (upgrader.dart:442)
3  ???                            0x0 State.widget + 925 (framework.dart:925)
4  ???                            0x0 UpgradeAlertState.checkVersion + 136 (upgrade_alert.dart:136)
5  ???                            0x0 UpgradeAlertState.build.<fn> + 124 (upgrade_alert.dart:124)
6  ???                            0x0 StreamBuilder.build + 437 (async.dart:437)
7  ???                            0x0 _StreamBuilderBaseState.build + 120 (async.dart:120)
8  ???                            0x0 StatefulElement.build + 5592 (framework.dart:5592)
9  ???                            0x0 ComponentElement.performRebuild + 5480 (framework.dart:5480)
10 ???                            0x0 StatefulElement.performRebuild + 5643 (framework.dart:5643)
11 ???                            0x0 Element.rebuild + 5196 (framework.dart:5196)
12 ???                            0x0 BuildOwner.buildScope + 2904 (framework.dart:2904)
13 ???                            0x0 WidgetsBinding.drawFrame + 989 (binding.dart:989)
14 ???                            0x0 RendererBinding._handlePersistentFrameCallback + 448 (binding.dart:448)
15 ???                            0x0 SchedulerBinding._invokeFrameCallback + 1386 (binding.dart:1386)
16 ???                            0x0 SchedulerBinding.handleDrawFrame + 1311 (binding.dart:1311)
17 ???                            0x0 SchedulerBinding._handleDrawFrame + 1169 (binding.dart:1169)
ismail-mufin commented 3 weeks ago

Android is working fine, this was the first time we experienced this problem on iOS as well. There was no problem with the patch we sent a few days ago.

As a workaround, we moved the upgrade package to local and edited the try-catch block.

sssolinjie commented 3 weeks ago

@eseidel @felangel Runner-2024-04-24-110436.txt

eseidel commented 3 weeks ago

Thank you, that's very helpful! We will look in the morning. We'll need to symbolicate it (which we should be able to do with the release number (12.4) and app_id you provided. Thank you!

Thread 8 name:  io.flutter.1.ui
Thread 8 Crashed:
0   libsystem_kernel.dylib                 0x1dcab6974 __pthread_kill + 8
1   libsystem_pthread.dylib                0x1f05390ec pthread_kill + 268
2   libsystem_c.dylib                      0x19c507b80 abort + 180
3   Flutter                                0x1048d92e8 0x103e3c000 + 11129576
4   Flutter                                0x1049bb7cc 0x103e3c000 + 12056524
5   Flutter                                0x1049b62d8 0x103e3c000 + 12034776
6   Flutter                                0x1049b1020 0x103e3c000 + 12013600
7   App                                    0x10de79f4c 0x10de74000 + 24396
8   Flutter                                0x1049bf4b8 0x103e3c000 + 12072120
9   Flutter                                0x1049c2c0c 0x103e3c000 + 12086284
10  Flutter                                0x1049158c0 0x103e3c000 + 11376832
11  Flutter                                0x104921bb8 0x103e3c000 + 11426744
12  Flutter                                0x1049271dc 0x103e3c000 + 11448796
13  Flutter                                0x1047293c4 0x103e3c000 + 9360324
14  Flutter                                0x1045f6814 0x103e3c000 + 8103956
15  Flutter                                0x1045f9fc8 0x103e3c000 + 8118216
16  CoreFoundation                         0x1945ff6e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
17  CoreFoundation                         0x1945ff388 __CFRunLoopDoTimer + 1004
18  CoreFoundation                         0x194589184 __CFRunLoopDoTimers + 288
19  CoreFoundation                         0x19458618c __CFRunLoopRun + 1856
20  CoreFoundation                         0x194585968 CFRunLoopRunSpecific + 608
21  Flutter                                0x1045fa0b4 0x103e3c000 + 8118452
22  Flutter                                0x1045f972c 0x103e3c000 + 8116012
23  libsystem_pthread.dylib                0x1f0535a90 _pthread_start + 136
24  libsystem_pthread.dylib                0x1f0534fcc thread_start + 8
eseidel commented 3 weeks ago

Thank you again for the report. @erickzanardo symbolicated it this morning:

Thread 8:
0    libsystem_kernel.dylib                   0x1dcab6974 __pthread_kill
1    libsystem_pthread.dylib                  0x1f05390ec pthread_kill
2    libsystem_c.dylib                        0x19c507b80 abort
3    Flutter                                  0x1048d92e8 dart::SimpleHashMap::Lookup(void*, unsigned int, bool) (in Flutter) (hashmap.cc:22)
4    Flutter                                  0x1049bb7cc dart::CanonicalPC(unsigned long) (in Flutter) (shorebird.cc:258)
5    Flutter                                  0x1049b62d8 dart::PatchableCallHandler::ResolveSwitchAndReturn(dart::Object const&) (in Flutter) (runtime_entry.cc:2535)
6    Flutter                                  0x1049b1020 dart::DRT_SwitchableCallMiss(dart::NativeArguments) (in Flutter) (runtime_entry.cc:2686)
7    App                                      0x10de79f4c stub CallClangCodeWithSimulatorArgs (in App) + 100
8    Flutter                                  0x1049bf4b8 dart::Simulator::DecodeExceptionGen(dart::Instr*) (in Flutter) (simulator_arm64.cc:1742)
9    Flutter                                  0x1049c2c0c dart::Simulator::Execute(char const*, dart::Simulator::SimulatorExecutionSource) (in Flutter) (simulator_arm64.cc:3824)
10   Flutter                                  0x1049158c0 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&) (in Flutter) (dart_entry.cc:114)
11   Flutter                                  0x104921bb8 dart::IsolateMessageHandler::HandleMessage(std::_fl::unique_ptr<dart::Message, std::_fl::default_delete<dart::Message>>) (in Flutter) (isolate.cc:1414)
12   Flutter                                  0x1049271dc dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) (in Flutter) (message_handler.cc:238)
13   Flutter                                  0x1047293c4 std::_fl::__function::__func<tonic::DartMessageHandler::OnMessage(tonic::DartState*)::$_0, std::_fl::allocator<tonic::DartMessageHandler::OnMessage(tonic::DartState*)::$_0>, void ()>::operator()() (in Flutter) (function.h:359)
14   Flutter                                  0x1045f6814 fml::MessageLoopImpl::FlushTasks(fml::FlushType) (in Flutter) (message_loop_impl.cc:128)
15   Flutter                                  0x1045f9fc8 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) (in Flutter) (message_loop_darwin.mm:86)
16   CoreFoundation                           0x1945ff6e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
17   CoreFoundation                           0x1945ff388 __CFRunLoopDoTimer
18   CoreFoundation                           0x194589184 __CFRunLoopDoTimers
19   CoreFoundation                           0x19458618c __CFRunLoopRun
20   CoreFoundation                           0x194585968 CFRunLoopRunSpecific
21   Flutter                                  0x1045fa0b4 fml::MessageLoopDarwin::Run() (in Flutter) (message_loop_darwin.mm:52)
22   Flutter                                  0x1045f972c 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*) (in Flutter) (thread:295)
23   libsystem_pthread.dylib                  0x1f0535a90 _pthread_start
24   libsystem_pthread.dylib                  0x1f0534fcc thread_start

We don't yet know why it's crashing there.

I don't see any RELEASE_ASSERTS or abort() in the Lookup function though.

We'd love to work with you to better understand. We need a way to reproduce to figure out more.

Perhaps you'd be available for a call? https://calendly.com/eseidel. We could potentially work with you to debug from your machine to better understand what's going on. We're also reachable via Discord most of the day: https://discord.gg/shorebird

felangel commented 3 weeks ago

After chatting on Discord we determined that the crash was due to using an older version of Shorebird's Flutter (3.19.4) which was pre-1.0.0 and had some known crashers. After the customer upgraded, they were unable to reproduce the crash using the latest Shorebird CLI and Flutter (3.19.5) 🎉