Skip to content

[VM] Process terminates with handled exceptions in FFI library #53267

Description

@blagoev
  • Dart SDK version: 3.1.0 (stable) (Tue Aug 15 21:33:36 2023 +0000) on "linux_x64"
  • Using the Dart supplied executable within the Flutter package
  • Linux, Ubuntu 20

We are seeing consistent process termination with the latest stable Dart executable on Linux with FFI
We have this code in the native library.

try {
    return f();
    }
    catch (...) {
        set_last_exception(std::current_exception());
        return {};
    };

The f() throws a std::exception.

The process ignores the catch(...) block and proceeds to terminate.

The same library binary file works correct when loaded by the previous Dart stable version 3.0 executable.

The stack trace at termination is this

        libc.so.6!__GI_raise(int sig=6, int sig@entry=6) Line 50	C	Symbols loaded.
 	libc.so.6!__GI_abort() Line 79	C	Symbols loaded.
 	libstdc++.so.6!__gnu_cxx::__verbose_terminate_handler()		No symbols loaded.
 	libstdc++.so.6![Unknown/Just-In-Time compiled code]		No symbols loaded.
 	libstdc++.so.6!__gxx_personality_v0		No symbols loaded.
 	[Unknown/Just-In-Time compiled code]		No symbols loaded.
 	_Unwind_RaiseException		No symbols loaded.
 	libgcc_s.so.1!_Unwind_Resume_or_Rethrow		No symbols loaded.
 	libstdc++.so.6!__cxa_rethrow		No symbols loaded.
 	libstdc++.so.6![Unknown/Just-In-Time compiled code]		No symbols loaded.
 	libstdc++.so.6!__gxx_personality_v0		No symbols loaded.
 	[Unknown/Just-In-Time compiled code]		No symbols loaded.
 	_Unwind_RaiseException		No symbols loaded.
 	libstdc++.so.6!__cxa_throw		No symbols loaded.
>	librealm_dart.so!realm::Object::verify_attached(const class realm::Object * const this=0x7fa54000e260) Line 179	C++	Symbols loaded.

In this case the f() is the verify_attached function which throws the exception.

The output contains

terminate called after throwing an instance of 'realm::InvalidatedObjectException'
terminate called recursively

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failuresarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-ffi

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions