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

Dart VM crash (Access Violation) on Windows (1.12.1) #28757

Closed
DanTup opened this issue Feb 12, 2017 · 3 comments
Closed

Dart VM crash (Access Violation) on Windows (1.12.1) #28757

DanTup opened this issue Feb 12, 2017 · 3 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DanTup
Copy link
Collaborator

DanTup commented Feb 12, 2017

While working on some code today using built_value I managed to get the Dart VM to crash (that is, Windows said dart.exe has encountered a problem and had to close rather than the normal exception spat to screen).

I was able to reduce the code to this very small sample:

import 'dart:async';

Future main() async {
  await doThing("test");
}

doThing<T>(String request) async {
  var a = new FullType(T);
}

class FullType {
  FullType(a);
}

When I run this, the VM crashes. I don't think this code logically makes much sense (I don't even know if Generics are supposed to work yet, and there's a mismatch of awaits and non-async code) but it doesn't seem like the VM should crash.

Most tweaks I try to simplify/correct the code stop the crash from occurring.

If I hit Debug in the Windows dialog I get the following information:

Unhandled exception at 0x00007FF60461094A in dart.exe: 0xC0000005:
Access violation reading location 0x0000000000000010.

I'm on Windows 10 Pro x64 running v1.21.1 of the SDK. I have the above code in a .dart file and I'm just running it with dart myfile.dart.

Dart crash

@lrhn
Copy link
Member

lrhn commented Feb 13, 2017

tl;dr: Shorter reproduction: main<T>() async { T; }. It's the T as an expression in an async function that crashes in the parser.

Running the original example with a debug-X64 build, I get:

../../runtime/vm/parser.cc: 7622: error: expected: FunctionLevel() > 0
Dumping native stack trace for thread 4ce3
  [0x000000000099c503] dart::Profiler::DumpStackTrace()
  [0x000000000099c503] dart::Profiler::DumpStackTrace()
  [0x000000000068d0b1] dart::DynamicAssertionHelper::Fail(char const*, ...)
  [0x00000000009256c0] dart::Parser::ParsePrimary()
  [0x000000000095933c] dart::Parser::ParsePostfixExpr()
  [0x0000000000956b62] dart::Parser::ParseUnaryExpr()
  [0x000000000092ea3d] dart::Parser::ParseBinaryExpr(int)
  [0x0000000000930a16] dart::Parser::ParseConditionalExpr()
  [0x0000000000926598] dart::Parser::ParseExpr(bool, bool)
  [0x000000000092e021] dart::Parser::ParseActualParameters(dart::ArgumentListNode*, bool)
  [0x00000000009235e7] dart::Parser::ParseNewOperator(dart::Token::Kind)
  [0x00000000009251fb] dart::Parser::ParsePrimary()
  [0x000000000095933c] dart::Parser::ParsePostfixExpr()
  [0x0000000000956b62] dart::Parser::ParseUnaryExpr()
  [0x000000000092ea3d] dart::Parser::ParseBinaryExpr(int)
  [0x0000000000930a16] dart::Parser::ParseConditionalExpr()
  [0x0000000000926598] dart::Parser::ParseExpr(bool, bool)
  [0x0000000000936439] dart::Parser::ParseAwaitableExpr(bool, bool, dart::SequenceNode**)
  [0x0000000000949e92] dart::Parser::ParseVariableDeclaration(dart::AbstractType const&, bool, bool, dart::SequenceNode**)
  [0x000000000094a3af] dart::Parser::ParseVariableDeclarationList()
  [0x000000000094c170] dart::Parser::ParseStatement()
  [0x00000000009349da] dart::Parser::ParseStatementSequence()
  [0x000000000091f229] dart::Parser::ParseFunc(dart::Function const&, bool)
  [0x000000000091cf49] dart::Parser::ParseFunction(dart::ParsedFunction*)
  [0x00000000006e9b00] dart::DartCompilationPipeline::ParseFunction(dart::ParsedFunction*)
  [0x00000000006ef3b0] Unknown symbol
  [0x00000000006eee4e] dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&)
  [0x00000000006e9f5b] dart::DRT_CompileFunction(dart::NativeArguments)
  [0x00007f100fd09630] [Stub] CallToRuntime
  [0x00007f100fd096b0] [Stub] LazyCompile
  [0x00007f100e08201d] _Closure.call
  [0x00007f100e08c1d0] Future.Future.microtask.<anonymous closure>
  [0x00007f100e08201d] _Closure.call
  [0x00007f100e08becf] _microtaskLoop
  [0x00007f100e08b9d9] _startMicrotaskLoop
  [0x00007f100e08b887] _startMicrotaskLoop
  [0x00007f100e08201d] _Closure.call
  [0x00007f100e08b731] _runPendingImmediateCallback
  [0x00007f100e0879bf] _RawReceivePortImpl._handleMessage
  [0x00007f100fd09a4b] [Stub] InvokeDartCode
  [0x0000000000707b28] dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)
  [0x00000000007078c4] dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&)
  [0x000000000070ac94] dart::DartLibraryCalls::HandleMessage(dart::Object const&, dart::Instance const&)
  [0x0000000000815fdd] dart::IsolateMessageHandler::HandleMessage(dart::Message*)
  [0x000000000084b049] dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)
  [0x000000000084b702] dart::MessageHandler::TaskCallback()
  [0x000000000084c173] Unknown symbol
-- End of DumpStackTrace

That suggests that the crash is in the parser, where the T in doThing is used as an expression in the argument list.

It is supposed to be a compile-time error - using a generic function type parameter as an expression - but not like this :)

@lrhn lrhn added area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Feb 13, 2017
@fsc8000
Copy link
Contributor

fsc8000 commented Feb 13, 2017

@crelier

@crelier
Copy link
Contributor

crelier commented Feb 13, 2017

Thanks for the report. The VM should not crash indeed.

@crelier crelier self-assigned this Feb 13, 2017
whesse pushed a commit that referenced this issue Feb 21, 2017
#28757).

Note that this code has no effect yet, because generic functions are not yet
fully supported (no regression test added).

R=hausner@google.com

Review-Url: https://codereview.chromium.org/2690923004 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants