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

Flutter crashes within the DartVM on certain eval calls #18573

Closed
jacob314 opened this issue Jun 18, 2018 · 21 comments
Closed

Flutter crashes within the DartVM on certain eval calls #18573

jacob314 opened this issue Jun 18, 2018 · 21 comments
Assignees
Milestone

Comments

@jacob314
Copy link
Contributor

Steps to Reproduce

I'll work on simpler repro steps that don't require IntelliJ or the widget inspector but filing this now to get started.

Open the Widget inspector in IntelliJ.
Inspect a widget on the device.
This triggers IntelliJ to send an eval call to the DartVM that has a name in scope. This in turn crashes the Flutter VM. The issue reproduces with a trivial flutter app (e.g. the getting started default app) or with the gallery app.

Logs

The crash looks like

compiler message: result 7a833dc9-e943-42ff-938a-19a7949fcdbe
compiler message: 7a833dc9-e943-42ff-938a-19a7949fcdbe build/app.dill.incremental.dill 0
../../third_party/dart/runtime/vm/kernel_binary.cc: 55: error: Invalid kernel binary: Indicated size is invalid.
Dumping native stack trace for thread 5d03
[0x000000010eb7fc24] dart::Profiler::DumpStackTrace(void*)
[0x000000010eb7fc24] dart::Profiler::DumpStackTrace(void*)
[0x000000010edf91e2] dart::Assert::Fail(char const*, ...)
[0x000000010ea85dd6] dart::kernel::Program::ReadFrom(dart::kernel::Reader*, bool)
[0x000000010ea86062] dart::kernel::Program::ReadFromBuffer(unsigned char const*, long, bool)
[0x000000010eab53a7] dart::EvaluateCompiledExpressionHelper(unsigned char const*, long, dart::Array const&, dart::String const&, dart::String const&, dart::Array const&, dart::TypeArguments const&)
[0x000000010eab531c] dart::Class::EvaluateCompiledExpression(unsigned char const*, long, dart::Array const&, dart::Array const&, dart::TypeArguments const&) const
[0x000000010ebf29ee] dart::EvaluateCompiledExpression(dart::Thread*, dart::JSONStream*)
[0x000000010ebe90ae] dart::Service::InvokeMethod(dart::Isolate*, dart::Array const&, bool)
[0x000000010ebe96ba] dart::Service::HandleIsolateMessage(dart::Isolate*, dart::Array const&)
[0x000000010ea698ab] dart::IsolateMessageHandler::HandleMessage(dart::Message*)
[0x000000010ea94b3e] dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)
[0x000000010ea94d96] dart::MessageHandler::HandleOOBMessages()
[0x000000010ec19679] dart::Thread::HandleInterrupts()
[0x000000010ebd8381] dart::DRT_StackOverflow(dart::NativeArguments)
[0x000000012e74085b] [Stub] CallToRuntime
[0x0000000136b77389] _AssertionError.Eval
[0x000000012e740ce3] [Stub] InvokeDartCode
[0x000000010ea3a1d5] dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)
@aam
Copy link
Member

aam commented Jun 18, 2018

I'm running flutter gallery in IJ with flutter from master:

Flutter 0.5.5-pre.46 • channel master • git@github.com:aam/flutter.git Framework • revision bd4cf62821 (7 hours ago) • 2018-06-18 15:17:02 +0200 Engine • revision c8eeee432b Tools • Dart 2.0.0-dev.61.0.flutter-31e3441816

Starting the app and clicking on different elements in Widgets tab in Flutter inspector IJ seems to work fine - appropriate source code is being selected in the editor. How do I reproduce the crash?

@jacob314
Copy link
Contributor Author

Select the widget on the device instead of in the tree view.

@DaveShuckerow
Copy link
Contributor

Hi, is there an update on this issue? It is blocking a roll of Flutter into g3.

@jacob314
Copy link
Contributor Author

The fix has landed flutter engine. I'm verifying that the bug is fixed now.

flutter/engine@549c855

@aam
Copy link
Member

aam commented Jun 19, 2018

The issue is believed to be fixed with dart roll that landed in flutter/engine#5559. The next step is to roll engine into flutter, which is pending on previous engine roll into flutter to be completed(#18575 - it has landed, but it's not clear whether it will stick).

@DaveShuckerow
Copy link
Contributor

This fix appears to be rolled in at fb8cbf2.

Can we close this issue yet?

@jacob314
Copy link
Contributor Author

Not yet. I still see exceptions with the fix.

@jacob314
Copy link
Contributor Author

It is believed that
dart-lang/sdk#33087 (comment)
will fully fix the issue once it is rolled into flutter-engine.

@Hixie Hixie added this to the bucket6 milestone Jun 26, 2018
@Hixie
Copy link
Contributor

Hixie commented Jul 3, 2018

@jacob314 Any updates? This is blocking all our rolls.

@aam
Copy link
Member

aam commented Jul 3, 2018

@Hixie wrote

@jacob314 Any updates? This is blocking all our rolls.

In #18657 we landed a workaround for this issue until dart roll with the fix lands. Dart roll has not landed yet since there was dart roll freeze until today, it's work in progress right now(flutter/engine#5610 landed dart sdk into engine, #19044 will land that engine into flutter).

@jacob314
Copy link
Contributor Author

Any update on when the full fix lands? The workaround isn't enough.

@aam
Copy link
Member

aam commented Jul 11, 2018

We tried landing it #19044, but had to revert it because it broke tests(with dart2 semantic enforcing type checks in flutter tools). Second attempt is underway: #19277

@aam
Copy link
Member

aam commented Jul 11, 2018

What are the issues you are seeing with the workaround?

@Hixie
Copy link
Contributor

Hixie commented Jul 12, 2018

@aam fwiw, this has been open so long now that we don't have any candidates for this beta cycle. In retrospect, we really should have reverted.

@jacob314
Copy link
Contributor Author

Adding the crashers seen on June 28th from the chat thread. I still see some crashes evaluating expressions when paused at breakpoints. I can't repro the exceptions with the engine roll attempt so I wouldn't spend time investigating them.
Stack traces:

compiler message: Unhandled exception:
compiler message: Unsupported operation: Cannot set value in unmodifiable Map
compiler message: #0      _ImmutableMap.[]= (dart:core-patch/dart:core/immutable_map.dart:72)
compiler message: #1      SourceLibraryBuilder.addToScope (package:front_end/src/fasta/source/source_library_builder.dart:706)
compiler message: #2      Import.finalizeImports.<anonymous closure> (package:front_end/src/fasta/import.dart:64)
compiler message: #3      Import.finalizeImports.<anonymous closure> (package:front_end/src/fasta/import.dart:78)
compiler message: #4      _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/dart:collection/compact_hash.dart:363)
compiler message: #5      Scope.forEach (package:front_end/src/fasta/scope.dart:251)
compiler message: #6      Import.finalizeImports (package:front_end/src/fasta/import.dart:71)
compiler message: #7      SourceLibraryBuilder.addImportsToScope (package:front_end/src/fasta/source/source_library_builder.dart:684)
compiler message: #8      KernelLibraryBuilder.addImportsToScope (package:front_end/src/fasta/kernel/kernel_library_builder.dart:1067)
compiler message: #9      IncrementalCompiler.compileExpression.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:485)
compiler message: <asynchronous suspension>
compiler message: #10     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118)
compiler message: #11     new Future.sync (dart:async/future.dart:222)
compiler message: #12     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:118)
compiler message: #13     _rootRun (dart:async/zone.dart:1126)
compiler message: #14     _CustomZone.run (dart:async/zone.dart:1023)
compiler message: #15     _runZoned (dart:async/zone.dart:1518)
compiler message: #16     runZoned (dart:async/zone.dart:1465)

Some examples:

compiler message: NoSuchMethodError: The getter 'className' was called on null.
compiler message: Receiver: null
compiler message: Tried calling: className
compiler message: #0      Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
compiler message: #1      serializeProcedure (package:front_end/src/fasta/kernel/utils.dart:82)
compiler message: #2      FrontendCompiler.compileExpression (package:vm/frontend_server.dart:452)
compiler message: <asynchronous suspension>
compiler message: #3      _FlutterFrontendCompiler.compileExpression (package:frontend_server/server.dart:55)
compiler message: #4      listenAndCompile.<anonymous closure> (package:vm/frontend_server.dart:650)
compiler message: <asynchronous suspension>
compiler message: #5      _RootZone.runUnaryGuarded (dart:async/zone.dart:1316)
compiler message: #6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336)
compiler message: #7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
compiler message: #8      _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68)
compiler message: #9      _EventSinkWrapper.add (dart:async/stream_transformers.dart:15)
compiler message: #10     _StringAdapterSink.add (dart:convert/string_conversion.dart:268)
compiler message: #11     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154)
compiler message: #12     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129)
compiler message: #13     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189)
compiler message: #14     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120)
compiler message: #15     _RootZone.runUnaryGuarded (dart:async/zone.dart:1316)
compiler message: #16     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336)
compiler message: #17     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)

Patching in the new engine roll things are better although it does appear users will have a bad time unless the know to manually delete their build directory. Without deleting the build directory I get this crasher on IOS:

Dumping native stack trace for thread 5c03
[0x00000001041c6d54] dart::Profiler::DumpStackTrace(void*)
[0x00000001041c6d54] dart::Profiler::DumpStackTrace(void*)
[0x0000000104444142] dart::Assert::Fail(char const*, ...)
[0x00000001040cdeeb] dart::kernel::Program::ReadFrom(dart::kernel::Reader*, bool)
[0x00000001040ce1a2] dart::kernel::Program::ReadFromBuffer(unsigned char const*, long, bool)
[0x00000001040fd6b7] dart::EvaluateCompiledExpressionHelper(unsigned char const*, long, dart::Array const&, dart::String const&, dart::String const&, dart::Array const&, dart::TypeArguments const&)
[0x0000000104127e68] dart::Library::EvaluateCompiledExpression(unsigned char const*, long, dart::Array const&, dart::Array const&, dart::TypeArguments const&) const
[0x000000010423a4b4] dart::EvaluateCompiledExpression(dart::Thread*, dart::JSONStream*)
[0x00000001042301ae] dart::Service::InvokeMethod(dart::Isolate*, dart::Array const&, bool)
[0x00000001042307ba] dart::Service::HandleIsolateMessage(dart::Isolate*, dart::Array const&)
[0x00000001040b19eb] dart::IsolateMessageHandler::HandleMessage(dart::Message*)
[0x00000001040dce4e] dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)
[0x00000001040dcf50] dart::MessageHandler::HandleNextMessage()
[0x00000001043c32a5] Dart_HandleMessage
[0x0000000103f2a4f5] tonic::DartMessageHandler::OnHandleMessage(tonic::DartState*)
[0x0000000103b994d4] fml::MessageLoopImpl::RunExpiredTasks()
[0x0000000103b9c1cc] fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*)
[0x0000000106694e64] __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
[0x0000000106694a52] __CFRunLoopDoTimer
[0x000000010669460a] __CFRunLoopDoTimers
[0x000000010668be4c] __CFRunLoopRun
[0x000000010668b30b] CFRunLoopRunSpecific
[0x0000000103b9c31d] fml::MessageLoopDarwin::Run()
[0x0000000103b9960b] fml::MessageLoopImpl::DoRun()
[0x0000000103b9bd22] std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0> >(void*, void*)
[0x000000010c00e661] _pthread_body
[0x000000010c00e50d] _pthread_body
[0x000000010c00dbf9] thread_start
-- End of DumpStackTrace

@aam
Copy link
Member

aam commented Jul 12, 2018

Adding the crashers seen on June 28th from the chat thread.

Ah, right, we need fix for dart-lang/sdk#33087 that landed on Jun 29.

@aam fwiw, this has been open so long now that we don't have any candidates for this beta cycle. In retrospect, we really should have reverted.

Well, who could have predicted we would be blocked from rolling framework forward for over two weeks.
Also, it is not a small issue in my opinion the fact that we used vm dart1 parser for expression evaluation until this change landed.

@a-siva
Copy link
Contributor

a-siva commented Jul 16, 2018

Can this issue be closed or at least the TODAY label removed as we have completed the roll of Dart into flutter and there are no known open issues with the expression evaluation code.

@a-siva
Copy link
Contributor

a-siva commented Jul 16, 2018

Checked with Jacob and he confirmed that crashes from eval expression were resolved with the latest Dart roll, the only issue remaining is the issue of exceptions resulting in engine crashes which is being tracked in #19354

@a-siva a-siva closed this as completed Jul 16, 2018
@vipinagrahari
Copy link

I am getting this error while trying to parse json responses to dart object.

I have no idea what is causing this problem. Google search landed me here. Following is the stack trace

Unhandled exception:
compiler message: NoSuchMethodError: The getter 'className' was called on null.
compiler message: Receiver: null
compiler message: Tried calling: className
compiler message: #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
compiler message: #1      serializeProcedure (package:front_end/src/fasta/kernel/utils.dart:82:29)
compiler message: #2      FrontendCompiler.compileExpression (package:vm/frontend_server.dart:473:16)
compiler message: <asynchronous suspension>
compiler message: #3      _FlutterFrontendCompiler.compileExpression (package:frontend_server/server.dart:55:22)
compiler message: #4      listenAndCompile.<anonymous closure> (package:vm/frontend_server.dart:671:20)
compiler message: <asynchronous suspension>
compiler message: #5      _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
compiler message: #6      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #7      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #8      _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
compiler message: #9      _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
compiler message: #10     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
compiler message: #11     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154:13)
compiler message: #12     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129:5)
compiler message: #13     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189:5)
compiler message: #14     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
compiler message: #15     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
compiler message: #16     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #17     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #18     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
compiler message: #19     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
compiler message: #20     _StringAdapterSink.add (dart:convert/string_conversion.dart:268:11)
compiler message: #21     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273:7)
compiler message: #22     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348:20)
compiler message: #23     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341:5)
compiler message: #24     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86:18)
compiler message: #25     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
compiler message: #26     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
compiler message: #27     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #28     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #29     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
compiler message: #30     _StreamController._add (dart:async/stream_controller.dart:639:7)
compiler message: #31     _StreamController.add (dart:async/stream_controller.dart:585:5)
compiler message: #32     _Socket._onData (dart:io/runtime/binsocket_patch.dart:1714:41)
compiler message: #33     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
compiler message: #34     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
compiler message: #35     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
compiler message: #36     _SyncStreamController._sendData (dart:async/stream_controller.dart:763:19)
compiler message: #37     _StreamController._add (dart:async/stream_controller.dart:639:7)
compiler message: #38     _StreamController.add (dart:async/stream_controller.dart:585:5)
compiler message: #39     new _RawSocket.<anonymous closure> (dart:io/runtime/binsocket_patch.dart:1276:33)
compiler message: #40     _NativeSocket.issueReadEvent.issue (dart:io/runtime/binsocket_patch.dart:819:14)
compiler message: #41     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
compiler message: #42     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
compiler message: #43     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
compiler message: #44     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)

@zoechi
Copy link
Contributor

zoechi commented Oct 11, 2018

@vipinagrahari please create a new issue with properly filled issue template.
This issue is long closed.
Please link to this issue from the new one.

@github-actions
Copy link

github-actions bot commented Sep 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants