shorebird icon indicating copy to clipboard operation
shorebird copied to clipboard

fix: Our Dart crashes when it should show isolate error

Open eseidel opened this issue 11 months ago • 2 comments

Something is broken in our Dart when handling a specific kind of isolate error.

Bryan accidentally discovered this with the 1.6.8 release.

If you check out https://github.com/shorebirdtech/shorebird/commit/3c6d23836cde247074ccc9248d6b1be120ca5a84

And try to run it with upstream dart, it shows this:

eseidel@erics-mbp shorebird % ./bin/shorebird preview        
Updating Flutter...
HEAD is now at 3d75b30b bump engine rev
Shorebird Engine • revision 9637b88761740c1ea1d6efac2e2b73235e6eb4de
Flutter 3.27.4-0.0.pre.13 • channel [user-branch] • unknown source
Framework • revision 3d75b30b18 (3 days ago) • 2025-01-28 19:25:00 -0500
Engine • revision 9637b88761
Tools • Dart 3.6.1 • DevTools 2.40.0
Building Shorebird...
Resolving dependencies... 
Downloading packages... 
Got dependencies.
✓ Fetching apps (0.2s)
Which app would you like to preview? hi_android
✓ Fetching releases (0.2s)
✓ Fetching releases (0.2s)
Which release would you like to preview? 1.0.0+1
✓ Fetching aab artifact (0.2s)
✓ Downloading release (0.2s)
Invalid argument(s): Illegal argument in isolate message: (object is a DynamicLibrary)
 <- _lib in Instance of 'UnixTerminal' (from package:mason_logger/src/ffi/unix_terminal.dart)
 <- _terminal in Instance of 'Logger' (from package:mason_logger/src/mason_logger.dart)
 <- Instance of 'ShorebirdCliCommandRunner' (from package:shorebird_cli/src/shorebird_cli_command_runner.dart)
 <- Instance of 'PreviewCommand' (from package:shorebird_cli/src/commands/preview_command.dart)
 <- field this in PreviewCommand.setChannelOnAab.<anonymous closure> (from package:shorebird_cli/src/commands/preview_command.dart)
 <- resultPort in Instance of '_RemoteRunner<Null>' (from dart:isolate)


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/eseidel/Library/Application Support/shorebird/logs/1738343928777_shorebird.log

But if you try to run with our dart: (shorebird uses our dart fork by default).

eseidel@erics-mbp shorebird % ./bin/shorebird preview        
Updating Flutter...
HEAD is now at 3d75b30b bump engine rev
Shorebird Engine • revision 9637b88761740c1ea1d6efac2e2b73235e6eb4de
Flutter 3.27.4-0.0.pre.13 • channel [user-branch] • unknown source
Framework • revision 3d75b30b18 (3 days ago) • 2025-01-28 19:25:00 -0500
Engine • revision 9637b88761
Tools • Dart 3.6.1 • DevTools 2.40.0
Building Shorebird...
Resolving dependencies... 
Downloading packages... 
Got dependencies.
✓ Fetching apps (0.2s)
Which app would you like to preview? hi_android
✓ Fetching releases (0.2s)
✓ Fetching releases (0.2s)
Which release would you like to preview? 1.0.0+1
✓ Fetching aab artifact (0.2s)
✓ Downloading release (0.2s)
../../flutter/third_party/dart/runtime/vm/object.h: 7195: error: unreachable code
zsh: abort      ./bin/shorebird preview

eseidel avatar Jan 31 '25 17:01 eseidel

This is the change that fixed the crash/error: https://github.com/shorebirdtech/shorebird/commit/3c6d23836cde247074ccc9248d6b1be120ca5a84

eseidel avatar Jan 31 '25 17:01 eseidel

I have a problem running shorebird preview when connecting a physical android phone with a cable

My version of shorebird shorebird doctor:

Shorebird 1.6.8 • [email protected]:shorebirdtech/shorebird.git
Flutter 3.27.3 • revision 3d75b30b181d1d4ce66c426c64aca2498529f2e0
Engine • revision 9637b88761740c1ea1d6efac2e2b73235e6eb4de

URL Reachability
✓ https://api.shorebird.dev OK (0.3s)
✓ https://console.shorebird.dev OK (0.5s)
✓ https://oauth2.googleapis.com OK (0.2s)
✓ https://storage.googleapis.com OK (0.7s)
✓ https://cdn.shorebird.cloud OK (0.5s)

✓ Shorebird is up-to-date (1.4s)
✓ AndroidManifest.xml files contain INTERNET permission (27ms)
✓ macOS app has correct entitlements (3ms)
✓ shorebird.yaml found in pubspec.yaml assets (4ms)
✓ Lock files are tracked in source control (44ms)
  [!] pubspec.lock is not tracked in source control. We recommend tracking lock files in source control to avoid unexpected dependency version changes.
1 issue detected.

The error that the console displays when running the command:

✓ Fetching releases (0.5s)
✓ Fetching releases (0.5s)
Which release would you like to preview? 1.0.9+107
Which platform would you like to preview? Android
✓ Fetching aab artifact (0.3s)
✓ Downloading release (0.3s)
✓ Using stable track (0.4s)
✓ Extracting metadata (0.4s)
✓ Built apks: /Users/wbbtech/Downloads/programs/shorebird/bin/cache/previews/072cf011-5a6e-40d8-9dce-7fa1010e024d/android_1.0.9+107_674124.apks (1.7s)
✗ Exception: Failed to install apks: The APKs have been extracted in the directory: /var/folders/91/5zjh9vld24b4fs722gwyzfnm0000gp/T/17737330490692209777
[BT:1.17.1] Error: Installation of the app failed.
com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Installation of the app failed.
        at com.android.tools.build.bundletool.model.exceptions.InternalExceptionBuilder.build(InternalExceptionBuilder.java:57)
        at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:196)
        at com.android.tools.build.bundletool.commands.InstallApksCommand.lambda$execute$2(InstallApksCommand.java:236)
        at com.android.tools.build.bundletool.device.AdbRunner.run(AdbRunner.java:81)
        at com.android.tools.build.bundletool.device.AdbRunner.run(AdbRunner.java:43)
        at com.android.tools.build.bundletool.commands.InstallApksCommand.execute(InstallApksCommand.java:236)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:117)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:55)
Caused by: com.android.ddmlib.InstallException: Failed to commit install session 1801937806 with command package install-commit 1801937806. Error: INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed collecting certificates for /data/app/vmdl1801937806.tmp/universal.apk: Failed to collect certificates from /data/app/vmdl1801937806.tmp/universal.apk: Attempt to get length of null array
        at com.android.ddmlib.SplitApkInstallerBase.installCommit(SplitApkInstallerBase.java:154)
        at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:85)
        at com.android.ddmlib.IDeviceSharedImpl.installPackages(IDeviceSharedImpl.java:395)
        at com.android.ddmlib.internal.DeviceImpl.lambda$installPackages$34(DeviceImpl.java:1484)
        at com.android.ddmlib.internal.DeviceImpl.logRun3(DeviceImpl.java:1826)
        at com.android.ddmlib.internal.DeviceImpl.installPackages(DeviceImpl.java:1481)
        at com.android.tools.build.bundletool.device.DdmlibDevice.installApks(DdmlibDevice.java:180)
        ... 6 more
 (4.6s)

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/wbbtech/Library/Application Support/shorebird/logs/1738601182306_shorebird.log

wbbtech avatar Feb 03 '25 16:02 wbbtech