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 after try to patch ios (Crash occurred when compiling unknown function in AOT mode in unknown pass) #2541

Open
rizkijuliansyaham opened this issue Oct 16, 2024 · 34 comments
Labels
bug Something isn't working crash ios waiting for response Waiting for customer response

Comments

@rizkijuliansyaham
Copy link

rizkijuliansyaham commented Oct 16, 2024

Description

I have no issues with the iOS release, but when applying a patch for iOS, I encounter errors. However, debugging on the simulator runs smoothly without any problems

Steps To Reproduce

When I apply a patch, an error like this appears

Building patch with Flutter 3.24.3 (5a6dc546e8)... (711.2s)Exited with code -6

===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=SEGV_MAPERR(1), si_addr=0xb6e8509c
version=3.5.3 (stable) (Mon Sep 30 11:25:48 2024 -0500) on "macos_simarm64"
pid=74684, thread=259, isolate_group=isolate(0x7f9f7f009800), isolate=isolate(0x7f9f7f00ea00)
os=macos, arch=arm64, comp=no, sim=yes
isolate_instructions=0, vm_instructions=0
fp=7ff7b5e9a1b0, sp=7ff7b5e9a170, pc=10a4ec294
  pc 0x000000010a4ec294 fp 0x00007ff7b5e9a1b0 dart::kernel::TranslationHelper::DartString(dart::kernel::StringIndex, dart::Heap::Space)+0x44
  pc 0x000000010a3104d4 fp 0x00007ff7b5e9af50 dart::Precompiler::DoCompileAll()+0x2e34
  pc 0x000000010a30d2f7 fp 0x00007ff7b5e9b3d0 dart::Precompiler::CompileAll()+0x957
  pc 0x000000010a06c79e fp 0x00007ff7b5e9bb50 dart::bin::CreateIsolateAndSnapshot(dart::bin::CommandLineOptions const&)+0x397e
  pc 0x000000010a07049a fp 0x00007ff7b5e9c040 main+0x10ea
  pc 0x00007ff807aa7366 fp 0x00007ff7b5e9c260 start+0x796
-- End of DumpStackTrace
=== Crash occurred when compiling unknown function in AOT mode in unknown pass
=== Flow Graph not available

fyi, my storage space is still large. I dont get the point why this case show on me. Thanks.

Additional Context
this is my shorebird version

Shorebird 1.4.0 • [email protected]:shorebirdtech/shorebird.git
Flutter 3.24.3 • revision 5a6dc546e8ecd01fe3b9527f082ff2d6864374f9
Engine • revision 033ec57900456ca7f8cd4bb59c2773a8ce27cb5d

this is my shorebird doctor

✓ Shorebird is up-to-date (2.1s)
✓ Flutter install is correct (1.0s)
✓ AndroidManifest.xml files contain INTERNET permission (93ms)
✓ Has access to api.shorebird.dev (0.8s)
✓ Has access to storage.googleapis.com (0.4s)
✓ shorebird.yaml found in pubspec.yaml assets (27ms)

this is my flutter doctor

✓] Flutter (Channel stable, 3.24.3, on macOS 14.4 23E214 darwin-x64, locale en-ID)
    • Flutter version 3.24.3 on channel stable at /Users/satuankerjati/DevLibrary/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/satuankerjati/Library/Android/sdk
    • Platform android-31, build-tools 30.0.2
    • Java binary at: /usr/bin/java
    • Java version Java(TM) SE Runtime Environment (build 16+36-2231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/macos-android-setup for detailed instructions).

[✓] IntelliJ IDEA Community Edition (version 2023.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 77.0.1
    • Dart plugin version 233.13135.65

[✓] Connected device (3 available)
    • Developer’s iPhone (mobile) • 00008120-000905390EF3C01E • ios            • iOS 16.2 20C65
    • macOS (desktop)             • macos                     • darwin-x64     • macOS 14.4 23E214 darwin-x64
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 129.0.6668.101

[✓] Network resources
    • All expected network resources are available.
@rizkijuliansyaham rizkijuliansyaham added the bug Something isn't working label Oct 16, 2024
@bryanoltman
Copy link
Contributor

For starters, can you share your app id, the release version, and the patch number where you saw this?

@bryanoltman bryanoltman changed the title fix: CRASH after try to patch ios (Crash occurred when compiling unknown function in AOT mode in unknown pass) fix: crash after try to patch ios (Crash occurred when compiling unknown function in AOT mode in unknown pass) Oct 16, 2024
@bryanoltman bryanoltman added the waiting for response Waiting for customer response label Oct 16, 2024
@rizkijuliansyaham
Copy link
Author

For starters, can you share your app id, the release version, and the patch number where you saw this?

2b9f7e47-5682-49ba-bf33-e0a7d977810e

this is my app id. Thanks

@eseidel eseidel added this to 1.1 Oct 21, 2024
@eseidel eseidel moved this to Customers in 1.1 Oct 21, 2024
@eseidel eseidel removed the waiting for response Waiting for customer response label Oct 21, 2024
@eseidel
Copy link
Contributor

eseidel commented Oct 21, 2024

For starters, can you share your app id, the release version, and the patch number where you saw this?

2b9f7e47-5682-49ba-bf33-e0a7d977810e

this is my app id. Thanks

Thank you.

@felangel
Copy link
Contributor

Can you share the release version as well as the full patch command that you ran? Thanks!

@felangel felangel added the waiting for response Waiting for customer response label Oct 23, 2024
@rizkijuliansyaham
Copy link
Author

rizkijuliansyaham commented Oct 24, 2024

Can you share the release version as well as the full patch command that you ran? Thanks!

this is my full patch cmd :

shorebird patch ios -t lib/main.dart --flavor prod --dart-define-from-file=env_prod.json --verbose

and the release version is 3.2.14+71

Thanks

@bryanoltman bryanoltman removed the waiting for response Waiting for customer response label Oct 25, 2024
@bryanoltman
Copy link
Contributor

@rizkijuliansyaham Out of curiosity, does this happen every time? If you create a new app using flutter create my_new_app, create a release, and attempt to patch it, do you see the same error?

@eseidel eseidel moved this from Customers to Todo in 1.1 Oct 25, 2024
@Richard-Van-Intania
Copy link

3.24.3 same error message here when build ipa, run on simulator no problem

@bryanoltman
Copy link
Contributor

It's unsurprising that this would run on the simulator, as that isn't using shorebird at all.

Does this command show you a path to a log file when it exits? If so, can you share it here?

@bryanoltman bryanoltman added the waiting for response Waiting for customer response label Oct 29, 2024
@Oladips
Copy link

Oladips commented Nov 4, 2024

Failed to create snapshot:
===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=SEGV_MAPERR(1), si_addr=0x15a94c09c
version=3.5.3 (stable) (Mon Sep 30 11:25:48 2024 -0500) on "macos_simarm64"
pid=89781, thread=259, isolate_group=isolate(0x7fbd98808200), isolate=isolate(0x7fbd9880da00)
os=macos, arch=arm64, comp=no, sim=yes
isolate_instructions=0, vm_instructions=0
fp=30e4281b0, sp=30e428170, pc=105062294
pc 0x0000000105062294 fp 0x000000030e4281b0 dart::kernel::TranslationHelper::DartString(dart::kernel::StringIndex, dart::Heap::Space)+0x44
pc 0x0000000104e864d4 fp 0x000000030e428f50 dart::Precompiler::DoCompileAll()+0x2e34
pc 0x0000000104e832f7 fp 0x000000030e4293d0 dart::Precompiler::CompileAll()+0x957
pc 0x0000000104be279e fp 0x000000030e429b50 dart::bin::CreateIsolateAndSnapshot(dart::bin::CommandLineOptions const&)+0x397e
pc 0x0000000104be649a fp 0x000000030e42a040 main+0x10ea
pc 0x000000020572f2cd fp 0x000000030e42a270 Unknown symbol
-- End of DumpStackTrace
=== Crash occurred when compiling unknown function in AOT mode in unknown pass
=== Flow Graph not available
(554.6s)
[Process.run] git symbolic-ref HEAD (in /Users/-------/.shorebird/bin/cache)
Exited with code 0

stdout:
refs/heads/stable

[Process.run] git rev-parse --verify HEAD (in /Users/-------/.shorebird/bin/cache)
Exited with code 0

stdout:
284eb5a

[Process.run] git remote prune origin (in /Users/-------/.shorebird/bin/cache)
Exited with code 0
[Process.run] git fetch --tags (in /Users/-------/.shorebird/bin/cache)
Exited with code 0
[Process.run] git rev-parse --verify @{upstream} (in /Users/-------/.shorebird/bin/cache)
Exited with code 0

stdout:
284eb5a

There's no mention of a log file.

@bryanoltman
Copy link
Contributor

@Oladips can you share the output of shorebird doctor -v as well as the command you're running?

@Oladips
Copy link

Oladips commented Nov 4, 2024

shorebird doctor -v
Shorebird 1.4.8 • [email protected]:shorebirdtech/shorebird.git
Flutter 3.24.4 • revision de629bcb9c96360eb3ca20fcc045263c19b1a33d
Engine • revision edb175f4b6894b63d8217952f0e4f59adb97a7e2

Logs: /Users/------/Library/Application Support/shorebird/logs
Android Toolchain
• Android Studio: /Applications/Android Studio.app/Contents
• Android SDK: /Users/------/Library/Android/sdk
• ADB: /Users/------/Library/Android/sdk/platform-tools/adb
• JAVA_HOME: /Applications/Android Studio.app/Contents/jbr/Contents/Home
• JAVA_EXECUTABLE: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• JAVA_VERSION: openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
OpenJDK 64-Bit Server VM (build 17.0.7+0-17.0.7b1000.6-10550314, mixed mode)

• Gradle: unknown

URL Reachability
https://api.shorebird.dev OK (0.8s)
https://console.shorebird.dev OK (1.1s)
https://oauth2.googleapis.com OK (0.9s)
https://storage.googleapis.com OK (0.5s)
https://cdn.shorebird.cloud OK (0.8s)

Network Speed
✓ GCP Upload Speed: 1.02 MB/s (5.7s)
✓ GCP Download Speed: 2.42 MB/s (6.9s)

✓ Shorebird is up-to-date (85.6s)
✓ Flutter install is correct (1.0s)
✓ AndroidManifest.xml files contain INTERNET permission (56ms)
✓ shorebird.yaml found in pubspec.yaml assets (15ms)

No issues detected!

command:
shorebird patch ios --flavor prod

@bryanoltman
Copy link
Contributor

Thank you! Forgot to ask earlier: what is your app id?

@Oladips
Copy link

Oladips commented Nov 4, 2024

This is the app id:
802410a9-2b63-486b-bb6a-d314c94075fb

@bryanoltman
Copy link
Contributor

Hmm, it appears as though we don't have an app with that ID. Was it deleted, perhaps?

@Oladips
Copy link

Oladips commented Nov 4, 2024

No it wasn't, it has a flavor config
This is the prod id: 70f58f3e-115c-4732-9027-354319eb0a44

@bryanoltman
Copy link
Contributor

Thank you! I'm not seeing anything obviously wrong—you seem to be running on the latest macOS and using a recent enough Xcode. Can you run shorebird cache clean and then try the patch command again?

@Oladips
Copy link

Oladips commented Nov 4, 2024

I cleared my shorebird cache.
Any shorebird command I run returns this.

my-app git:(v3) ✗ shorebird
Updating Flutter...
error: The following untracked working tree files would be overwritten by checkout:
.ci.yaml
.gitattributes
.github/ISSUE_TEMPLATE/10_feature.yml
.github/ISSUE_TEMPLATE/1_activation.yml
.github/ISSUE_TEMPLATE/2_bug.yml
.github/ISSUE_TEMPLATE/3_feature_request.yml
.github/ISSUE_TEMPLATE/4_performance_others.yml
.github/ISSUE_TEMPLATE/5_performance_speed.yml
.github/ISSUE_TEMPLATE/6_infrastructure.yml
.github/ISSUE_TEMPLATE/7_cherry_pick.yml
.github/ISSUE_TEMPLATE/8_design_doc.yml
.github/ISSUE_TEMPLATE/9_first_party_packages.yml
.github/ISSUE_TEMPLATE/config.yml
.github/PR_TEMPLATE/PULL_REQUEST_CP_TEMPLATE.md
.github/PULL_REQUEST_TEMPLATE.md

@Oladips
Copy link

Oladips commented Nov 4, 2024

Then it goes long and at the end I see Aborting

@bryanoltman
Copy link
Contributor

Very odd, it looks like something got corrupted with your shorebird installation. If you try reinstalling shorebird (usually this is rm -rf ~/.shorebird and then curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash), does the problem go away?

@Oladips
Copy link

Oladips commented Nov 4, 2024

This fixes it but I still get the same error

Which release would you like to patch? 3.1.36+8
✓ Installing Flutter 3.24.3 (5a6dc546e8) (29.0s)
✓ Running flutter precache (152.2s)
✓ Fetching xcarchive artifact (0.8s)
✓ Downloading xcarchive (100%) (53.6s)
✓ Downloading aot-tools.dill... (0.5s)
✓ Extracting aot-tools.dill... (3.6s)
✗ Failed to create snapshot:
===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=SEGV_MAPERR(1), si_addr=0x158ccc09c
version=3.5.3 (stable) (Mon Sep 30 11:25:48 2024 -0500) on "macos_simarm64"
pid=49649, thread=259, isolate_group=isolate(0x7ff77980a000), isolate=isolate(0x7ff77980fe00)
os=macos, arch=arm64, comp=no, sim=yes
isolate_instructions=0, vm_instructions=0
fp=30aa87d40, sp=30aa87d00, pc=1033ec294
pc 0x00000001033ec294 fp 0x000000030aa87d40 dart::kernel::TranslationHelper::DartString(dart::kernel::StringIndex, dart::Heap::Space)+0x44
pc 0x00000001032104d4 fp 0x000000030aa88ae0 dart::Precompiler::DoCompileAll()+0x2e34
pc 0x000000010320d2f7 fp 0x000000030aa88f60 dart::Precompiler::CompileAll()+0x957
pc 0x0000000102f6c79e fp 0x000000030aa896e0 dart::bin::CreateIsolateAndSnapshot(dart::bin::CommandLineOptions const&)+0x397e
pc 0x0000000102f7049a fp 0x000000030aa89bd0 main+0x10ea
pc 0x0000000203a052cd fp 0x000000030aa89e00 Unknown symbol
-- End of DumpStackTrace
=== Crash occurred when compiling unknown function in AOT mode in unknown pass
=== Flow Graph not available
(718.0s)

If you aren't sure why this command failed, re-run with the --verbose flag to see more information.

You can also file an issue if you think this is a bug. Please include the following log file in your report:
/Users/------/Library/Application Support/shorebird/logs/1730743167060_shorebird.log

Uploading 1730743167060_shorebird.log.zip…

@Oladips
Copy link

Oladips commented Nov 4, 2024

@felangel
Copy link
Contributor

felangel commented Nov 4, 2024

That looks like the artifacts are outdated. This error means that gen_snapshot is expecting a newer kernel format and we are using the older kernel format. Does the error also occur if you create a brand new flutter app (flutter create example -e) and release/patch with a fresh shorebird installation?

Can you also share the md5 of your gen_snapshot executable?

md5 ~/.shorebird/bin/cache/flutter/5a6dc546e8ecd01fe3b9527f082ff2d6864374f9/bin/cache/artifacts/engine/ios-release/gen_snapshot_arm64

@Oladips
Copy link

Oladips commented Nov 4, 2024

This is the md5:

MD5 (/Users/----/.shorebird/bin/cache/flutter/5a6dc546e8ecd01fe3b9527f082ff2d6864374f9/bin/cache/artifacts/engine/ios-release/gen_snapshot_arm64) = b0e1d4c654e8ec7fefcae519fc54c0b9

Do you mean I should create a new app and try it with shorebird release/patch, I need clarification on this?

At the moment, release works fine, no issues.
Patch works fine on android, only iOS has this issue

@felangel
Copy link
Contributor

felangel commented Nov 4, 2024

Do you mean I should create a new app and try it with shorebird release/patch, I need clarification on this?

Yeah I meant is this only happening in your current project or does it happen in a new empty Flutter project as well?

@Oladips
Copy link

Oladips commented Nov 4, 2024

This happens only in my current project, it's theonly one I have running on shorebird

@felangel
Copy link
Contributor

felangel commented Nov 4, 2024

Sounds like we're using the wrong app.dill. Can you try removing your build directory and trying again?

@Oladips
Copy link

Oladips commented Nov 4, 2024

Screenshot 2024-11-04 at 20 20 28

It's just running infinitely

@felangel
Copy link
Contributor

felangel commented Nov 4, 2024

Screenshot 2024-11-04 at 20 20 28 It's just running infinitely

Can you re-run with the -v flag to see what step is taking so long?

@Oladips
Copy link

Oladips commented Nov 4, 2024

Screenshot 2024-11-04 at 20 45 50

@felangel
Copy link
Contributor

felangel commented Nov 4, 2024

Can you share the contents of build/link.jsonl?

@Oladips
Copy link

Oladips commented Nov 4, 2024

I can't find the aforementioned file in my build folder.

@felangel
Copy link
Contributor

felangel commented Nov 4, 2024

Hmm are you able to make a minimal reproduction sample? If not I'm happy to jump on a call to debug. The easiest way is to ping us on Discord.

@Oladips
Copy link

Oladips commented Nov 5, 2024

Hi, sorry for the late reply, I am not able to make a reproduction sample.

@rizkijuliansyaham
Copy link
Author

@rizkijuliansyaham Out of curiosity, does this happen every time? If you create a new app using flutter create my_new_app, create a release, and attempt to patch it, do you see the same error?

I am sorry for late respond. at new project my condition is same with @Oladips , new project running normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash ios waiting for response Waiting for customer response
Projects
Status: Todo
Development

No branches or pull requests

6 participants