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

[vm/ffi] Allocation in no-safepoint-scope #39868

Open dcharkes opened 4 years ago

dcharkes commented 4 years ago

The FFI tries to allocate an object in a no-safepoint-scope on arm64. (The test does not fail on other architectures.)

The test that triggers this passes a null to trigger an exception in the trampoline.

$ python tools/test.py -n dartkp-android-debug-arm64 ffi/regress_39068_test
Test configuration:
    dartkp-android-debug-arm64(architecture: arm64, compiler: dartkp, mode: debug, runtime: dart_precompiled, system: android)
Suites tested: ffi
Found 1 Android devices.

FAILED: dartkp-dart_precompiled debug_arm64 ffi/regress_39068_test
Expected: Pass Slow
Actual: Crash
Unexpected compile error.

--- Command "vm_compile_to_kernel []" (took 04.000870s):
DART_CONFIGURATION=DebugAndroidARM64 /usr/local/google/home/dacoharkes/master/sdk/pkg/vm/tool/gen_kernel --aot --platform=out/DebugAndroidARM64/vm_platform_strong.dill -o /usr/local/google/home/dacoharkes/master/sdk/out/DebugAndroidARM64/generated_compilations/dartkp/tests_ffi_regress_39068_test/out.dill /usr/local/google/home/dacoharkes/master/sdk/tests/ffi/regress_39068_test.dart --packages=/usr/local/google/home/dacoharkes/master/sdk/.packages -Ddart.developer.causal_async_stacks=true

exit code:
0

--- Command "precompiler" (took 07.000320s):
DART_CONFIGURATION=DebugAndroidARM64 out/DebugAndroidARM64/clang_x64/gen_snapshot --snapshot-kind=app-aot-elf --elf=/usr/local/google/home/dacoharkes/master/sdk/out/DebugAndroidARM64/generated_compilations/dartkp/tests_ffi_regress_39068_test/out.aotsnapshot --ignore-unrecognized-flags --packages=/usr/local/google/home/dacoharkes/master/sdk/.packages /usr/local/google/home/dacoharkes/master/sdk/out/DebugAndroidARM64/generated_compilations/dartkp/tests_ffi_regress_39068_test/out.dill

exit code:
-6

stderr:
../../runtime/vm/object.cc: 2384: error: expected: thread->no_safepoint_scope_depth() == 0
version=2.8.0-edge.8d11c1dce64ac98315b1df08553ae3fe9b7bf823 (Thu Dec 19 06:59:28 2019 +0000) on "linux_simarm64"
thread=84914, isolate=isolate(0x55f38dd834d0)
  pc 0x000055f38c3a090c fp 0x00007ffeb5200080 dart::Profiler::DumpStackTrace(void*)
  pc 0x000055f38c13e372 fp 0x00007ffeb5200160 dart::Assert::Fail(char const*, ...)
  pc 0x000055f38c2ca883 fp 0x00007ffeb52001d0 dart::Object::Allocate(long, long, dart::Heap::Space)
  pc 0x000055f38c35cf3c fp 0x00007ffeb5200220 dart::Array::New(long, long, dart::Heap::Space)
  pc 0x000055f38c2d237e fp 0x00007ffeb5200250 dart::Array::New(long, dart::Heap::Space)
  pc 0x000055f38c457395 fp 0x00007ffeb52002c0 out/DebugAndroidARM64/clang_x64/gen_snapshot+0x90f395
  pc 0x000055f38c45716f fp 0x00007ffeb5200340 out/DebugAndroidARM64/clang_x64/gen_snapshot+0x90f16f
  pc 0x000055f38c457fee fp 0x00007ffeb5200370 out/DebugAndroidARM64/clang_x64/gen_snapshot+0x90ffee
  pc 0x000055f38c452c37 fp 0x00007ffeb5200400 dart::RawString* dart::Symbols::NewSymbol<dart::CharArray<unsigned char> >(dart::Thread*, dart::CharArray<unsigned char> const&)
  pc 0x000055f38c452850 fp 0x00007ffeb5200460 dart::Symbols::FromUTF8(dart::Thread*, unsigned char const*, long)
  pc 0x000055f38c2c4ee8 fp 0x00007ffeb5200500 dart::String::ScrubName(dart::String const&, bool)
  pc 0x000055f38c4719ac fp 0x00007ffeb5200550 dart::TypeTestingStubNamer::StringifyType(dart::AbstractType const&) const
  pc 0x000055f38c47168c fp 0x00007ffeb5200580 dart::TypeTestingStubNamer::StubNameForType(dart::AbstractType const&) const
  pc 0x000055f38c259a72 fp 0x00007ffeb52005c0 dart::AssemblyCodeNamer::AssemblyNameFor(long, dart::Code const&)
  pc 0x000055f38c25b36f fp 0x00007ffeb5200770 dart::BlobImageWriter::WriteText(dart::WriteStream*, bool)
  pc 0x000055f38c259035 fp 0x00007ffeb5200810 dart::ImageWriter::Write(dart::WriteStream*, bool)
  pc 0x000055f38c1d6344 fp 0x00007ffeb52009e0 dart::FullSnapshotWriter::WriteIsolateSnapshot(long)
  pc 0x000055f38c1d652a fp 0x00007ffeb5200a10 dart::FullSnapshotWriter::WriteFullSnapshot()
  pc 0x000055f38c903ddc fp 0x00007ffeb5200d90 Dart_CreateAppAOTSnapshotAsElf
  pc 0x000055f38c11408e fp 0x00007ffeb5200f10 dart::bin::main(int, char**)
-- End of DumpStackTrace

--- Re-run this test:
python tools/test.py -n dartkp-android-debug-arm64 ffi/regress_39068_test
mraleph commented 4 years ago

Does not seem to be FFI specific at all based on the stack trace.

/cc @mkustermann

dcharkes commented 4 years ago

N.b. this failure was approved by someone - I only noticed this while running all tests locally with test.py (instead of test.dart).

For triaging it might me worthwhile querying the results database about when this started failing.