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.21k stars 1.57k forks source link

dartium crashes in debug mode on isolate/spawn_uri_multi_test #16534

Closed a-siva closed 9 years ago

a-siva commented 10 years ago

http://chromegw.corp.google.com/i/client.dart/builders/dartium-lucid64-debug-dev/builds/79/steps/drt_core_checked_tests/logs/stdio

stderr: ../../dart/runtime/vm/allocation.h:53: error: expected: top == this

CRASHED - renderer (pid 17225)

EOF

The coredump file shows the following backtrace: gdb) where

­0 0x00007f04458c8425 in __GI_raise (sig=<optimized out>)

    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64

­1 0x00007f04458cbb8b in __GI_abort () at abort.c:91

­2 0x0000000004a383e1 in dart::DynamicAssertionHelper::Fail (

    this=0x7f043d032310, format=0x722e902 "expected: %s")     at ../../dart/runtime/platform/assert.cc:40

­3 0x00000000047fc038 in dart::StackResource::~StackResource (

    this=0x7f043d032380, __in_chrg=<optimized out>)     at ../../dart/runtime/vm/allocation.h:53

­4 0x000000000480f02a in dart::MonitorLocker::~MonitorLocker (

    this=0x7f043d032380, __in_chrg=<optimized out>)     at ../../dart/runtime/vm/thread.h:48

­5 0x0000000004a33265 in dart::ThreadInterrupter::Register (

    callback=0x49fed7c <dart::Profiler::RecordSampleInterruptCallback(dart::InterruptedThreadState const&, void*)>, data=0x7f044b2d9020)     at ../../dart/runtime/vm/thread_interrupter.cc:143

­6 0x00000000049fec66 in dart::Profiler::BeginExecution (

    isolate=0x7f044b2d9020) at ../../dart/runtime/vm/profiler.cc:134

­7 0x0000000004956321 in dart::Isolate::SetCurrent (current=0x7f044b2d9020)

    at ../../dart/runtime/vm/isolate.cc:350

­8 0x00000000047e43cf in dart::Dart_EnterIsolate (dart_isolate=0x7f044b2d9020)

    at ../../dart/runtime/vm/dart_api_impl.cc:934

­9 0x000000000274c4fb in WebCore::DartIsolateScope::DartIsolateScope (

    this=0x7f043d0324b0, isolate=0x7f044b2d9020)     at ../../third_party/WebKit/Source/bindings/dart/DartUtilities.h:630

­10 0x000000000274a709 in WebCore::messageNotifyCallback (

    destinationIsolate=0x7f044b2d9020)     at ../../third_party/WebKit/Source/bindings/dart/DartController.cpp:361

­11 0x00000000049550ce in dart::IsolateMessageHandler::MessageNotify (

    this=0x296b476f14d0, priority=dart::Message::kNormalPriority)     at ../../dart/runtime/vm/isolate.cc:98

­12 0x000000000495cf98 in dart::MessageHandler::PostMessage (

    this=0x296b476f14d0, message=0x0)     at ../../dart/runtime/vm/message_handler.cc:119

­13 0x00000000049fe55b in dart::PortMap::PostMessage (message=0x296b46642260)

    at ../../dart/runtime/vm/port.cc:228

­14 0x00000000050b2d91 in dart::DN_HelperSendPortImplsendInternal (

    isolate=0x7f044b2d9820, arguments=0x7f043d033040)     at ../../dart/runtime/lib/isolate.cc:95

­15 0x00000000050b2ad8 in dart::BootstrapNatives::DN_SendPortImplsendInternal

    (args=0x7f043d033040) at ../../dart/runtime/lib/isolate.cc:83

a-siva commented 10 years ago

The following code in DartController.cpp is buggy as it allows for an isolate to run on two threads at the same time:

static void messageNotifyCallback(Dart_Isolate destinationIsolate) {     DartIsolateScope scope(destinationIsolate);     DartDOMData domData = DartDOMData::current();     ASSERT(domData->isDOMEnabled());     ExecutionContext destinationContext = domData->scriptExecutionContext();     destinationContext->postTask(adoptPtr(new MessageNotifyTask(domData->threadSafeIsolateWrapper()))); }

We need to change typedef void (Dart_MessageNotifyCallback)(Dart_Isolate dest_isolate); to typedef void (Dart_MessageNotifyCallback)(Dart_Isolate dest_isolate, void* isolate_callback_data);

This would ensure that the callback does not have to switch isolates the way it is doing now.

a-siva commented 10 years ago

https://codereview.chromium.org/155503003 fixes this.


Added Fixed label.