typedb-driver
typedb-driver copied to clipboard
Promise should not attempt to resolve more than once over the FFI boundary
Description
Calling Promise.resolve()
more than once causes a segmentation fault.
Reproducible Steps
- Set up
val relationType = transaction.concepts().putRelationType(relationName)
relationType.resolve()
relationType.resolve()
- Unexpected result
Rust driver attempts to resolve (and free) the same promise twice, leading to segmentation violation:
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000014aecf440, pid=22760, tid=8963
Expected result
Either an exception thrown, or the promise resolved to the same value both times.
Additional information
Relevant logs from TypeDB or Driver:
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::connection::credential::Credential> @ 0x600003abf7a0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::connection::credential::Credential> @ 0x600003abf7a0
[2024-04-16T11:32:28Z TRACE typedb_driver_sync::connection::network::stub] renewing token...
[2024-04-16T11:32:28Z TRACE typedb_driver_sync::connection::network::stub] sending token request...
[2024-04-16T11:32:28Z TRACE typedb_driver_sync::connection::network::stub] renewed token
[2024-04-16T11:32:28Z TRACE typedb_driver_sync::connection::network::stub] renewing token...
[2024-04-16T11:32:28Z TRACE typedb_driver_sync::connection::network::stub] sending token request...
[2024-04-16T11:32:28Z TRACE typedb_driver_sync::connection::network::stub] renewed token
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::connection::connection::Connection> @ 0x600002fb69a0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::connection::connection::Connection> @ 0x600002fb69a0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::database::database_manager::DatabaseManager> @ 0x600002fb6ac0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::connection::connection::Connection> @ 0x600002fb69a0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::user::user_manager::UserManager> @ 0x600002fb6c40
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::common::options::Options> @ 0x600001eed2c0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::database::database_manager::DatabaseManager> @ 0x600002fb6ac0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::common::options::Options> @ 0x600001eed2c0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::database::session::Session> @ 0x134105ee0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::common::options::Options> @ 0x600001e8d180
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::database::session::Session> @ 0x134105ee0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::common::options::Options> @ 0x600001e8d180
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::transaction::Transaction> @ 0x6000028b0190
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::transaction::Transaction> @ 0x6000028b0190
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_clib::concept::ConceptPromise> @ 0x6000009adfe0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Taking ownership of <typedb_driver_clib::concept::ConceptPromise> @ 0x6000009adfe0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_sync::concept::Concept> @ 0x600002fb36c0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing (mut) <typedb_driver_sync::concept::Concept> @ 0x600002fb36c0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Borrowing <typedb_driver_sync::transaction::Transaction> @ 0x6000028b0190
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Releasing ownership of <typedb_driver_clib::promise::VoidPromise> @ 0x60000098aaf0
[2024-04-16T11:32:28Z TRACE typedb_driver_clib::memory] Taking ownership of <typedb_driver_clib::concept::ConceptPromise> @ 0x6000009adfe0
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000014aecf440, pid=22760, tid=8963
#
# JRE version: OpenJDK Runtime Environment Zulu11.56+19-CA (11.0.15+10) (build 11.0.15+10-LTS)
# Java VM: OpenJDK 64-Bit Server VM Zulu11.56+19-CA (11.0.15+10-LTS, mixed mode, tiered, compressed oops, g1 gc, bsd-aarch64)
# Problematic frame:
# C [libtypedb_driver_jni.dylib+0x43440] _$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnOnce$LT$Args$GT$$GT$::call_once::h0c32637cb04c3c70+0x1c