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

Assert in libtimer_impl.dart #33838

Closed
jacob314 opened this issue Jul 12, 2018 · 31 comments
Closed

Assert in libtimer_impl.dart #33838

jacob314 opened this issue Jul 12, 2018 · 31 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-isolate

Comments

@jacob314
Copy link
Member

Synced to the following version of flutter I sometimes see this spurious looking assert.
flutter/flutter@700cb76

The assert that triggers is here. Likely the call to cancelWakeup should be skipped if the _sendPort is null or _scheduledWakeupTime is already null.

// Cancel pending wakeups in the event handler.
static void _cancelWakeup() {
  assert(_sendPort != null); <-- assert
  VMLibraryHooks.eventHandlerSendData(null, _sendPort, _NO_TIMER);
  _scheduledWakeupTime = null;
}

Stack trace:

E/flutter ( 9865): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 9865): 'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433 pos 12: '_sendPort != null': is not true.
E/flutter ( 9865): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:37:39)
E/flutter ( 9865): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:33:5)
E/flutter ( 9865): #2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart)
E/flutter ( 9865): #3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
E/flutter ( 9865): #4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
E/flutter ( 9865): #5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
@jacob314 jacob314 added the area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. label Jul 12, 2018
@DanTup
Copy link
Collaborator

DanTup commented Oct 31, 2018

There was a hot reload test failure in an engine roll that looks similar to this:

https://cirrus-ci.com/task/6149166369603584

  Expected: contains '(((((RELOAD WORKED)))))'
    Actual: '[{"event":"app.progress","params":{"appId":"7b9e8ab6-065d-49ca-9154-9fd03cfb748d","id":"1","progressId":"hot.reload","message":"Initializing hot reload..."}}]\n'
              '[{"event":"app.progress","params":{"appId":"7b9e8ab6-065d-49ca-9154-9fd03cfb748d","id":"2","progressId":null,"message":"Syncing files to device Flutter test device..."}}]\n'
              '[{"event":"app.progress","params":{"appId":"7b9e8ab6-065d-49ca-9154-9fd03cfb748d","id":"2","progressId":null,"finished":true}}]\n'
              '[ERROR:e:\\b\\build\\slave\\windows_engine\\build\\src\\flutter\\shell\\common\\shell.cc(184)] Dart Error: Unhandled exception:\n'
              '\'dart:isolate/runtime/libtimer_impl.dart\': Failed assertion: line 433: \'<optimized out>\': is not true.\n'
              '#0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)\n'
              '#1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)\n'
              '#2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)\n'
              '#3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)\n'
              '#4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)\n'
              '#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)\n'
              '[{"event":"app.progress","params":{"appId":"7b9e8ab6-065d-49ca-9154-9fd03cfb748d","id":"1","progressId":"hot.reload","finished":true}}]\n'
              'Reloaded 1 of 417 libraries in 35,702ms.\n'
              '[{"id":1,"result":{"code":0,"message":"Reloaded 1 of 417 libraries"}}]\n'
              ''
  package:test                                 expect
  test\integration\hot_reload_test.dart 45:13  main.<fn>.<fn>

@DanTup
Copy link
Collaborator

DanTup commented Dec 18, 2018

I've seen this in Dart Code's integration tests too (Flutter Ver: 1.1.2, Linux):

[FlutterRun]  <== [        ] Evicting dirty assets
[FlutterRun]  <== [        ] Sending to VM service: ext.flutter.evict({value: AssetManifest.json, isolateId: isolates/1061022884})
[FlutterRun]  <== [        ] Sending to VM service: ext.flutter.evict({value: FontManifest.json, isolateId: isolates/1061022884})
[FlutterRun]  <== [   +6 ms] Sending to VM service: ext.flutter.evict({value: LICENSE, isolateId: isolates/1061022884})
[FlutterRun]  <== [   +3 ms] Result: {value: , type: _extensionType, method: ext.flutter.evict}
[Observatory] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Debug","event":{"type":"Event","kind":"PauseException","isolate":{"type":"@Isolate","fixedId":true,"id":"isolates\/1061022884","name":"main.dart:main()","number":"1061022884"},"timestamp":1545137786229,"topFrame":{"type":"Frame","kind":"Regular","location":{"type":"SourceLocation","script":{"type":"@Script","fixedId":true,"id":"libraries\/@0150898\/scripts\/dart%3Acore%2Fruntime%2Fliberrors_patch.dart\/0","uri":"dart:core\/runtime\/liberrors_patch.dart","_kind":"kernel"},"tokenPos":1272},"function":{"type":"@Function","fixedId":true,"id":"classes\/149\/functions\/_doThrowNew%400150898","name":"_doThrowNew","_vmName":"_doThrowNew@0150898","owner":{"type":"@Class","fixedId":true,"id":"classes\/149","name":"_AssertionError","_vmName":"_AssertionError@0150898"},"_kind":"RegularFunction","static":true,"const":false,"_intrinsic":false,"_native":true},"code":{"type":"@Code","fixedId":true,"id":"code\/373afcff-7ffa3ca40c00","name":"_AssertionError._doThrowNew","_vmName":"_doThrowNew","kind":"Dart","_optimized":false,"_intrinsic":false,"_native":true},"vars":[{"type":"BoundVariable","name":"assertionStart","value":{"type":"@Instance","_vmType":"Smi","class":{"type":"@Class","fixedId":true,"id":"classes\/49","name":"_Smi","_vmName":"_Smi@0150898"},"kind":"Int","fixedId":true,"id":"objects\/int-13932","valueAsString":"13932"},"declarationTokenPos":1184,"scopeStartTokenPos":1184,"scopeEndTokenPos":1273},{"type":"BoundVariable","name":"assertionEnd","value":{"type":"@Instance","_vmType":"Smi","class":{"type":"@Class","fixedId":true,"id":"classes\/49","name":"_Smi","_vmName":"_Smi@0150898"},"kind":"Int","fixedId":true,"id":"objects\/int-13949","valueAsString":"13949"},"declarationTokenPos":1204,"scopeStartTokenPos":1204,"scopeEndTokenPos":1273},{"type":"BoundVariable","name":"message","value":{"type":"@Instance","_vmType":"null","class":{"type":"@Class","fixedId":true,"id":"classes\/119","name":"Null"},"kind":"Null","fixedId":true,"id":"objects\/null","valueAsString":"null"},"declarationTokenPos":1225,"scopeStartTokenPos":1225,"scopeEndTokenPos":1273}],"index":0},"exception":{"type":"@Instance","class":{"type":"@Class","fixedId":true,"id":"classes\/149","name":"_AssertionError","_vmName":"_AssertionError@0150898"},"kind":"PlainInstance","id":"objects\/1126"}}}}
[Observatory] ==> {"id":"439","method":"evaluate","params":{"expression":"toString()","isolateId":"isolates/1061022884","targetId":"objects/1126"}}
[Observatory] <== {"jsonrpc":"2.0", "result":{"type":"@Instance","_vmType":"String","class":{"type":"@Class","fixedId":true,"id":"classes\/71","name":"_OneByteString","_vmName":"_OneByteString@0150898"},"kind":"String","id":"objects\/1127","length":102,"valueAsString":"'dart:isolate\/runtime\/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true."},"id":"439"}
[General]     [stopped] exception

@jbg
Copy link

jbg commented Dec 25, 2018

I get this assert failure about 20% of the time when launching a debug build of a Flutter app on an Android device.
flutter/flutter@7a88fbc5fd

@p30arena
Copy link

p30arena commented Jan 5, 2019

Built build\app\outputs\apk\debug\app-debug.apk.
D/        ( 3323): HostConnection::get() New Host Connection established 0xae40f700, tid 3349
W/        ( 3323): Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1
D/EGL_emulation( 3323): eglMakeCurrent: 0xadb8f800: ver 2 0 (tinfo 0xae4127d0)
E/flutter ( 3323): [ERROR:flutter/shell/common/shell.cc(186)] Dart Error: Unhandled exception:
E/flutter ( 3323): 'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
E/flutter ( 3323): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter ( 3323): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter ( 3323): #2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
E/flutter ( 3323): #3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
E/flutter ( 3323): #4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
E/flutter ( 3323): #5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
method not available: ext.flutter.showPerformanceOverlaymethod not available: ext.flutter.debugAllowBannermethod not available: ext.flutter.debugPaintBaselinesEnabledmethod not available: ext.flutter.inspector.show
Application finished.
Exited (sigint)

@filiph
Copy link
Contributor

filiph commented Jan 13, 2019

This just happened to me on stable.

[VERBOSE-2:shell.cc(184)] Dart Error: Unhandled exception:
'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
#0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
#1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
#2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
#3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
#4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

Flutter Doctor

$ flutter doctor -v
[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.1 18B75, locale en-US)
    • Flutter version 1.0.0 at /Users/filiph/dev/flutter
    • Framework revision 5391447fae (6 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/filiph/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] Connected device (1 available)
    • iPhone X • 020C1218-499F-4C9F-A288-5B37E321BF7D • ios • iOS 12.0 (simulator)

• No issues found!

@oliverbytes
Copy link

happened to me as well today on stable..

@cbfischer
Copy link

happened to me as well today on master..

@rmawatson
Copy link

rmawatson commented Feb 10, 2019

same problem in an isolate launched from android. Goes away with a longer Duration before the timer triggers.. from 1 seconds to 4 seconds. I start the timer as the first thing in the isolate. Running on an intel vm of android. I don't see a problem when using my ARM phone.

[ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
    'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
    #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
    #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
    #2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
    #3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
    #4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
    #5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

@liamappelbe
Copy link
Contributor

@rmawatson or anyone else, what's the easiest way to reproduce this? I haven't been able to repro this at all yet.

Based on @rmawatson's description, I'm currently running the demo app and launching an isolate as soon as the app starts that runs this function:

timers(dynamic) {
  print("Starting timers...");
  new Timer(new Duration(milliseconds: 1), () => print("Hello!!! 1"));
  new Timer(new Duration(milliseconds: 10), () => print("Hello!!! 10"));
  new Timer(new Duration(milliseconds: 100), () => print("Hello!!! 100"));
  new Timer(new Duration(milliseconds: 1000), () => print("Hello!!! 1000"));
  new Timer(new Duration(milliseconds: 10000), () => print("Hello!!! 10000"));
}

This seems to work correctly no matter how often I restart or hot-reload. None of the timers seem to trigger the assert. Is there something else I need to do? I'm running on an x86 android emulator.

@rmawatson
Copy link

rmawatson commented Feb 15, 2019

This happened to me only when starting up an isolate from Android and using the timer. And only when running in a virtual machine. I used the 7.1 64bit version in vmware from https://www.osboxes.org/android-x86/ - It was ok on my Android 6.0 phone.

in dart.

void isolateMain() {
  WidgetsFlutterBinding.ensureInitialized();
  Timer(new Duration(milliseconds: 1),() => print("Hello!!!"));
}

In the android activity.

FlutterNativeView backgroundView = new FlutterNativeView(this.getApplicationContext(),true);
GeneratedPluginRegistrant.registerWith(backgroundView.getPluginRegistry());
FlutterRunArguments bvargs = new FlutterRunArguments();
bvargs.bundlePath = FlutterMain.findAppBundlePath(getApplicationContext());
bvargs.entrypoint = "isolateMain";
backgroundView.runFromBundle(bvargs);

Edit:
I am seeing this on my phone too.

@DanTup
Copy link
Collaborator

DanTup commented Feb 20, 2019

I think all instances I've seen of this have been during hot reloads right after the verbose log says ext.flutter.evict is being called:

[09:18:10] [FlutterRun] [Info] <== [   +1 ms] Sending to VM service: ext.flutter.evict({value: AssetManifest.json, isolateId: isolates/304443703})
[09:18:10] [FlutterRun] [Info] <== [        ] Sending to VM service: ext.flutter.evict({value: FontManifest.json, isolateId: isolates/304443703})
[09:18:10] [FlutterRun] [Info] <== [   +1 ms] Sending to VM service: ext.flutter.evict({value: LICENSE, isolateId: isolates/304443703})
[09:18:10] [Observatory] [Info] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Debug","event":{"type":"Event","kind":"PauseException","isolate":{"type":"@Isolate","fixedId":true,"id":"isolates\/304443703","name":"main.dart:main()","number":"304443703"},"timestamp":1550654290925,"topFrame":{"type":"Frame","kind":"Regular","location":{"type":"SourceLocation","script":{"type":"@Script","fixedId":true,"id":"libraries\/@0150898\/scripts\/dart%3Acore%2Fruntime%2Fliberrors_patch.dart\/0","uri":"dart:core\/runtime\/liberrors_patch.dart","_kind":"kernel"},"tokenPos":1272},"function":{"type":"@Function","fixedId":true,"id":"classes\/146\/functions\/_doThrowNew%400150898","name":"_doThrowNew","_vmName":"_doThrowNew@0150898","owner":{"type":"@Class","fixedId":true,"id":"classes\/146","name":"_AssertionError","_vmName":"_AssertionError@0150898"},"_kind":"RegularFunction","static":true,"const":false,"_intrinsic":false,"_native":true},"code":{"type":"@Code","fixedId":true,"id":"code\/47c115c3-7fc1307dc280","name":"[Unoptimized] _AssertionError._doThrowNew","_vmName":"[Unoptimized] _doThrowNew","kind":"Dart","_optimized":false,"_intrinsic":false,"_native":true},"vars":[{"type":"BoundVariable","name":"assertionStart","value":{"type":"@Instance","_vmType":"Smi","class":{"type":"@Class","fixedId":true,"id":"classes\/47","name":"_Smi","_vmName":"_Smi@0150898"},"kind":"Int","fixedId":true,"id":"objects\/int-13927","valueAsString":"13927"},"declarationTokenPos":1184,"scopeStartTokenPos":1184,"scopeEndTokenPos":1273},{"type":"BoundVariable","name":"assertionEnd","value":{"type":"@Instance","_vmType":"Smi","class":{"type":"@Class","fixedId":true,"id":"classes\/47","name":"_Smi","_vmName":"_Smi@0150898"},"kind":"Int","fixedId":true,"id":"objects\/int-13944","valueAsString":"13944"},"declarationTokenPos":1204,"scopeStartTokenPos":1204,"scopeEndTokenPos":1273},{"type":"BoundVariable","name":"message","value":{"type":"@Instance","_vmType":"null","class":{"type":"@Class","fixedId":true,"id":"classes\/117","name":"Null"},"kind":"Null","fixedId":true,"id":"objects\/null","valueAsString":"null"},"declarationTokenPos":1225,"scopeStartTokenPos":1225,"scopeEndTokenPos":1273}],"index":0},"exception":{"type":"@Instance","class":{"type":"@Class","fixedId":true,"id":"classes\/146","name":"_AssertionError","_vmName":"_AssertionError@0150898"},"kind":"PlainInstance","id":"objects\/1210"}}}}
[09:18:10] [Observatory] [Info] ==> {"id":"455","method":"evaluate","params":{"expression":"toString()","isolateId":"isolates/304443703","targetId":"objects/1210"}}
[09:18:10] [Observatory] [Info] <== {"jsonrpc":"2.0", "result":{"type":"@Instance","_vmType":"String","class":{"type":"@Class","fixedId":true,"id":"classes\/69","name":"_OneByteString","_vmName":"_OneByteString@0150898"},"kind":"String","id":"objects\/1211","length":102,"valueAsString":"'dart:isolate\/runtime\/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true."},"id":"455"}

@kikang72
Copy link

kikang72 commented Feb 20, 2019

For me it was definitely related to reload, but sort of the opposite of many of the comments that I see. It turned out that I used the property "debugShowCheckedModeBanner" for the initial MaterialApp object, but got the error when I launched the debugger. When I comment it out and then start the application again, the error does not occur. Finally, I then un-comment the line (while the app is already loaded) and the error still does not appear. It seems to be only occurring on the initial start of the app. I believe this to be a flutter bug on load sequence and possibly a race condition issue.

@DanTup
Copy link
Collaborator

DanTup commented Feb 20, 2019

@kikang72 Can you reproduce that from a simple flutter create'd app? Are you using VS Code?

@kikang72
Copy link

kikang72 commented Feb 20, 2019

@kikang72 Can you reproduce that from a simple flutter create'd app? Are you using VS Code?

I am using VS Code. I just ran a "flutter create" with the line commented and un-commented. Both succeeded.

updated: I did just notice that when I do "flutter run" that the "debugShowCheckedModeBanner" line is ignored even though I have it set to false.

@DanTup
Copy link
Collaborator

DanTup commented Feb 20, 2019

I did just notice that when I do "flutter run" that the "debugShowCheckedModeBanner" line is ignored even though I have it set to false.

Yeah, I suspected that may happen when you mentioned it. VS Code keeps track of whether the banner is on or off (you can toggle it from a command) and re-transmits it when the app starts. At the time I wrote that I didn't realise it could be hard-coded as off in the app, so it's likely we're overwriting it immediately at startup. I've opened Dart-Code/Dart-Code#1474 about that.

@DanTup
Copy link
Collaborator

DanTup commented Mar 6, 2019

I'm not sure if more data helps, but I'm seeing the same while trying to track down flakes in Dart DevTools tests too. Like the Flutter + Dart Code ones mentioned above, it was during a hot reload.

[ERROR:flutter/shell/common/shell.cc(178)] Dart Error: Unhandled exception:
<== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Extension","event":{"type":"Event","kind":"Extension","extensionKind":"Flutter.ServiceExtensionStateChanged","isolate":{"type":"@Isolate","fixedId":true,"id":"isolates\/301559493","name":"main.dart:main()","number":"301559493"},"timestamp":1551862128282,"extensionData":{"extension":"ext.flutter.evict","value":""}}}}
<== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Extension","event":{"type":"Event","kind":"Extension","extensionKind":"Flutter.ServiceExtensionStateChanged","isolate":{"type":"@Isolate","fixedId":true,"id":"isolates\/301559493","name":"main.dart:main()","number":"301559493"},"timestamp":1551862128282,"extensionData":{"extension":"ext.flutter.evict","value":""}}}}
'dart:isolate/runtime/lib/timer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
#0      _AssertionError._doThrowNew (dart:core/runtime/lib/errors_patch.dart:40:39)
#1      _AssertionError._throwNew (dart:core/runtime/lib/errors_patch.dart:36:5)
#2      _Timer._cancelWakeup (dart:isolate/runtime/lib/timer_impl.dart:433:12)
#3      _Timer._notifyEventHandler (dart:isolate/runtime/lib/timer_impl.dart:299:7)
#4      _Timer._handleMessage (dart:isolate/runtime/lib/timer_impl.dart:419:5)
#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/lib/isolate_patch.dart:171:12)
05:57 +5 -1: test/service_manager_test.dart: serviceManagerTests callService [E]

@willvlad
Copy link

willvlad commented Mar 6, 2019

Same here. Been seeing this for the last few days. Any thoughts how to get rid of it?

E/flutter (21008): 'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
E/flutter (21008): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter (21008): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter (21008): #2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
E/flutter (21008): #3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
E/flutter (21008): #4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
E/flutter (21008): #5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)```

@mleonhard
Copy link

When this error appears in the logs, my app's RPC code fails or callbacks fail to run. I don't know if it's a bug in my code or in the Flutter runtime. It happens often in the Android API 28 image and rarely in the API 21 image. I haven't noticed it in iOS Simulator. Would someone please investigate?

Launching lib/main_android_emulator.dart on Android SDK built for x86 64 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
Syncing files to device Android SDK built for x86 64...
D/        ( 3224): HostConnection::get() New Host Connection established 0x7f9e09533080, tid 3244
D/EGL_emulation( 3224): eglMakeCurrent: 0x7f9e0807e0c0: ver 3 0
I/flutter ( 3224): HTTP POST to http://10.0.2.2:5001
E/flutter ( 3224): [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: Unhandled exception:
E/flutter ( 3224): 'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
E/flutter ( 3224): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter ( 3224): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter ( 3224): #2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
E/flutter ( 3224): #3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
E/flutter ( 3224): #4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
E/flutter ( 3224): #5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

@diver2
Copy link

diver2 commented Mar 14, 2019

happened to me today... I am not using timers at all... during a hot restart...
W/art (19485): Before Android 4.1, method double java.util.concurrent.ThreadLocalRandom.internalNextDouble(double, double) would have incorrectly overridden the package-private method in java.util.Random
W/art (19485): Before Android 4.1, method int java.util.concurrent.ThreadLocalRandom.internalNextInt(int, int) would have incorrectly overridden the package-private method in java.util.Random
W/art (19485): Before Android 4.1, method long java.util.concurrent.ThreadLocalRandom.internalNextLong(long, long) would have incorrectly overridden the package-private method in java.util.Random
I/art (19485): Do partial code cache collection, code=30KB, data=22KB
I/art (19485): After code cache collection, code=30KB, data=22KB
I/art (19485): Increasing code cache capacity to 128KB
E/flutter (19485): 'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '': is not true.
E/flutter (19485): #0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter (19485): #1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter (19485): #2 _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
E/flutter (19485): #3 _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
E/flutter (19485): #4 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
E/flutter (19485): #5 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

running on a samsung S6
just posting this here to see if I help... code runs even with this error

@jacob314
Copy link
Member Author

Please let me know if there is anything we can do to help diagnose this issue. I see this issue periodically as well on a iOS emulator.

dart-bot pushed a commit that referenced this issue Mar 21, 2019
This seems to fix the issue, but it's a flaky crash so it's hard to 100% verify.

Bug: #33838
Bug: flutter/devtools#337
Change-Id: Ic037a94cfb9fe7da319d7d4b20e3a3efd0c7289f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97541
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
@liamappelbe
Copy link
Contributor

I think that change fixed the bug, but since it's an uncommon flake it's a bit hard to 100% verify. Closing for now, but let me know if it still happens after applying the change.

@ch-muhammad-adil
Copy link

I am facing this error.

[VERBOSE-2:shell.cc(178)] Dart Error: Unhandled exception:
'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
#0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
#1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
#2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
#3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
#4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
#5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)


adil$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.3)
[✓] Connected device (1 available)

• No issues found!

How can i fix it ? it is random behaviour of the app .

@DanTup
Copy link
Collaborator

DanTup commented Mar 26, 2019

@ch-muhammad-adil the fix mentioned above was only committed recently so is not in the Stable version of Flutter yet. You could try switching to the Master channel to see if the issue goes away (see https://github.com/flutter/flutter/wiki/Flutter-build-release-channels#how-to-change-channels) though be aware that's bleeding-edge code so you may come across other issues (in which case you may wish to wait until the fix makes it to dev, beta or the stable channel).

@ch-muhammad-adil
Copy link

Thank @DanTup , i will wait for it than.

@jonahwilliams
Copy link
Contributor

We have reports of this occurring with google3 customers, and it can be reliably reproduced externally as well.

  1. Comment out all assets in the flutter_gallery pubspec.
  2. flutter run flutter_gallery.
  3. Uncomment all assets and perform hot reload.

@liamappelbe
Copy link
Contributor

@jonahwilliams I tried those steps and wasn't able to reproduce it. This particular assertion can't really be triggered anymore, because my change removed it. I'm not sure if the change is in stable yet. It's possible that the people reporting the issue don't have the fix yet.

Alternatively, it might be a similar looking but different assertion. If so, can you file a new issue and include a stack trace?

@mannprerak2
Copy link

Got this today..
I am trying to run a dart isolate from a service,
its not crashing though

E/flutter (22681): [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: Unhandled exception:
E/flutter (22681): 'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
E/flutter (22681): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter (22681): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter (22681): #2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
E/flutter (22681): #3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
E/flutter (22681): #4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
E/flutter (22681): #5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

@mliitfall
Copy link

also have this issue:

E/flutter (13293): [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: Unhandled exception:
E/flutter (13293): 'dart:isolate/runtime/libtimer_impl.dart': Failed assertion: line 433: '<optimized out>': is not true.
E/flutter (13293): #0      _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter (13293): #1      _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter (13293): #2      _Timer._cancelWakeup (dart:isolate/runtime/libtimer_impl.dart:433:12)
E/flutter (13293): #3      _Timer._notifyEventHandler (dart:isolate/runtime/libtimer_impl.dart:299:7)
E/flutter (13293): #4      _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:419:5)
E/flutter (13293): #5      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

@jacob314
Copy link
Member Author

@mliitfall what version of the Flutter SDK are you running?

@mliitfall
Copy link

mliitfall commented Apr 28, 2019

@jacob314 it's randomly happen, i need to hot restart to run the app again

[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.4 18E226, locale en-ID)
    • Flutter version 1.2.1 at /Users/mliit/Documents/flutter
    • Framework revision 8661d8aecd (2 months ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/mliit/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 35.0.1
    • Dart plugin version 183.5901
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.33.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.25.0

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API
      28) (emulator)


@jacob314
Copy link
Member Author

As soon as Flutter releases the next stable version you will stop seeing the issue. You can also switch to the Beta channel if the issue is blocking your work.
https://github.com/flutter/flutter/wiki/Flutter-build-release-channels#beta

Thanks,
Jacob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-isolate
Projects
None yet
Development

No branches or pull requests