patrol icon indicating copy to clipboard operation
patrol copied to clipboard

Patrol should gracefully fail if emulator is shut down during test

Open dkbast opened this issue 1 year ago • 0 comments

Steps to reproduce

  1. run a longer running patrol test on an android emulator
  2. force quit the emulator
  3. patrol cli now stuck in a loop, no exit using ctrl+c

Actual results

I was running a test which was stuck (totally fine during development) - decided to cold boot my emulator.

Now I cannot exit out of the patrol cli as its caught in this infinite loop of 'error while disposing'.

The cli should be able to terminate if there is a fatal error.

Specifically it should react to ctrl-c and forcefully close everything.

Logs

Logs

✗ Failed to execute tests of apk with entrypoint test_bundle.dart on emulator-5554 (Gradle test execution failed with code 1) (385.4s)
Exception: Gradle test execution failed with code 1
See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it.
^C^Cerror while disposing
Bad state: This dispose scope is already disposed
#0      DisposeScope.dispose (package:dispose_scope/src/dispose_scope.dart:33:7)
#1      PatrolCommandRunner.dispose (package:patrol_cli/src/runner/patrol_command_runner.dart:266:27)
#2      patrolCommandRunner.<anonymous closure> (package:patrol_cli/src/runner/patrol_command_runner.dart:63:18)
#3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)
#4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:365:11)
#5      _DelayedData.perform (dart:async/stream_impl.dart:541:14)
#6      _PendingEvents.handleNext (dart:async/stream_impl.dart:646:11)
#7      _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:617:7)
#8      _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#9      _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#10     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#11     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:185:5)

^Cerror while disposing
Bad state: This dispose scope is already disposed
...

Patrol version

patrol: ^3.11.1

Patrol Doctor output

Patrol Doctor output
Patrol doctor:
Patrol CLI version: 3.2.0
Flutter command: flutter 
  Flutter 3.24.3 • channel stable
Android: 
• Program adb found in /opt/homebrew/bin/adb
• Env var $ANDROID_HOME set to /Users/<user>/Library/Android/sdk
iOS / macOS: 
• Program xcodebuild found in /usr/bin/xcodebuild
• Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller

Flutter Doctor output

Flutter Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.2.1 23C71 darwin-arm64,
    locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version
    33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.91.1)
[✓] Connected device (5 available)
[✓] Network resources

dkbast avatar Oct 21 '24 16:10 dkbast