dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.27k stars 1.58k forks source link

Race: local functions are sometimes created by the background compiler #29293

Open rmacnak-google opened 7 years ago

rmacnak-google commented 7 years ago

Cf. #29230


../../runtime/vm/object.cc: 6721: error: expected: Thread::Current()->IsMutatorThread()
Dumping native stack trace for thread 6539
  [0x00000000009c0b93] dart::Profiler::DumpStackTrace()
  [0x00000000009c0b93] dart::Profiler::DumpStackTrace()
  [0x0000000000697011] dart::DynamicAssertionHelper::Fail(char const*, ...)
  [0x00000000008bb3f0] dart::Function::NewClosureFunction(dart::String const&, dart::Function const&, dart::TokenPosition)
  [0x000000000096c0f8] dart::Parser::ParseFunctionStatement(bool)
  [0x000000000094557a] dart::Parser::ParsePrimary()
  [0x000000000097b18c] dart::Parser::ParsePostfixExpr()
  [0x00000000009789b2] dart::Parser::ParseUnaryExpr()
  [0x000000000094f59d] dart::Parser::ParseBinaryExpr(int)
  [0x0000000000951596] dart::Parser::ParseConditionalExpr()
  [0x0000000000947148] dart::Parser::ParseExpr(bool, bool)
  [0x000000000094eb81] dart::Parser::ParseActualParameters(dart::ArgumentListNode*, bool)
  [0x000000000097be10] dart::Parser::ParseInstanceCall(dart::AstNode*, dart::String const&, dart::TokenPosition, bool)
  [0x000000000097a05e] dart::Parser::ParseSelectors(dart::AstNode*, bool)
  [0x000000000097b1d6] dart::Parser::ParsePostfixExpr()
  [0x00000000009789b2] dart::Parser::ParseUnaryExpr()
  [0x000000000094f59d] dart::Parser::ParseBinaryExpr(int)
  [0x0000000000951596] dart::Parser::ParseConditionalExpr()
  [0x0000000000947148] dart::Parser::ParseExpr(bool, bool)
  [0x0000000000957089] dart::Parser::ParseAwaitableExpr(bool, bool, dart::SequenceNode**)
  [0x000000000096b682] dart::Parser::ParseVariableDeclaration(dart::AbstractType const&, bool, bool, dart::SequenceNode**)
  [0x000000000096bb9f] dart::Parser::ParseVariableDeclarationList()
  [0x000000000096d8d0] dart::Parser::ParseStatement()
  [0x000000000095555a] dart::Parser::ParseStatementSequence()
  [0x0000000000940082] dart::Parser::ParseFunc(dart::Function const&, bool)
  [0x000000000093d96c] dart::Parser::ParseFunction(dart::ParsedFunction*)
  [0x00000000006fb730] dart::DartCompilationPipeline::ParseFunction(dart::ParsedFunction*)
  [0x0000000000701391] Unknown symbol
  [0x00000000007024c9] dart::Compiler::CompileOptimizedFunction(dart::Thread*, dart::Function const&, long)
  [0x000000000070443b] dart::BackgroundCompiler::Run()
-- End of DumpStackTrace

Command[vm]: DART_CONFIGURATION=DebugX64 out/DebugX64/dart --optimization-counter-threshold=5 --error_on_bad_type --error_on_bad_override --ignore-unrecognized-flags --packages=/usr/local/google/home/rmacnak/ssd/dart1/sdk/.packages /usr/local/google/home/rmacnak/ssd/dart1/sdk/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart
Took 0:00:20.768740

Short reproduction command (experimental):
    python tools/test.py -t120 service/pause_on_unhandled_async_exceptions2_test

``
rmacnak-google commented 7 years ago

This ought to be impossible because a function should only be compiled by the background compiler if it had already been compiled once by the mutator.