Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise should not attempt to resolve more than once over the FFI boundary #634

Open
dmitrii-ubskii opened this issue Apr 16, 2024 · 0 comments
Assignees

Comments

@dmitrii-ubskii
Copy link
Member

Description

Calling Promise.resolve() more than once causes a segmentation fault.

Reproducible Steps

  1. Set up
    val relationType = transaction.concepts().putRelationType(relationName)
    relationType.resolve()
    relationType.resolve()
  1. 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
@farost farost self-assigned this Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants