C++ compiler version: g++ 7.3.1
Hazelcast Cpp client version: 5.0.0
OS version (Windows/Linux/OSX): Linux
/hazelcast-cpp-client-5.0.0/hazelcast/src/hazelcast/cp/cp_impl.cpp:73: std::unordered_map<hazelcast::cp::raft_group_id, hazelcast::cp::internal::session::proxy_session_manager::session_state>::iterator hazelcast::cp::internal::session::proxy_session_manager::create_new_session(const hazelcast::cp::raft_group_id&): Assertion `result.second' failed.
Thread 38 (Thread 0x7f42687f0700 (LWP 300907)):
#0 0x00007f428a35f1ff in select () from /lib64/libc.so.6
#1 0x00000000004630e3 in segv_handler (sig=6, info=<optimized out>)
#2 <signal handler called>
#3 0x00007f428a286a9f in raise () from /lib64/libc.so.6
#4 0x00007f428a259e05 in abort () from /lib64/libc.so.6
#5 0x00007f428a259cd9 in __assert_fail_base.cold.0 () from /lib64/libc.so.6
#6 0x00007f428a27f3f6 in __assert_fail () from /lib64/libc.so.6
#7 0x00007f428c11994c in hazelcast::cp::internal::session::proxy_session_manager::create_new_session(hazelcast::cp::raft_group_id const&) () from /home/user/app/lib/libhazelcast-cpp-client.so.5.0.0
#8 0x00007f428c1197a1 in hazelcast::cp::internal::session::proxy_session_manager::get_or_create_session(hazelcast::cp::raft_group_id const&) () from /home/user/app/lib/libhazelcast-cpp-client.so.5.0.0
#9 0x00007f428c1194c7 in hazelcast::cp::internal::session::proxy_session_manager::acquire_session(hazelcast::cp::raft_group_id const&) () from /home/user/app/lib/libhazelcast-cpp-client.so.5.0.0
#10 0x00007f428c0834e8 in hazelcast::cp::fenced_lock::lock_and_get_fence()::{lambda()#1}::operator()() const () from /home/user/app/lib/libhazelcast-cpp-client.so.5.0.0
#11 0x00007f428c0836b2 in hazelcast::cp::fenced_lock::lock_and_get_fence() () from /home/user/app/lib/libhazelcast-cpp-client.so.5.0.0
#12 0x00007f428c082eea in hazelcast::cp::fenced_lock::lock() () from /home/user/app/lib/libhazelcast-cpp-client.so.5.0.0
Expected behaviour
No asserts :)
Looking at the implementation, I suspect that the assert() itself is not actually valid here.
|
auto result = sessions_.emplace(group_id, session_state{response.id, response.ttl_millis}); |
|
assert(result.second); |
The assert checks if a new sessions_ map entry has been created, however create_new_session() is called by get_or_create_session() also if an existing session entry is found but it is invalid. In that case the map entry already exists and the assert will fail.
|
if (session == sessions_.end() || !session->second.is_valid()) { |
|
session = create_new_session(group_id); |
|
} |
C++ compiler version: g++ 7.3.1
Hazelcast Cpp client version: 5.0.0
OS version (Windows/Linux/OSX): Linux
Expected behaviour
No asserts :)
Looking at the implementation, I suspect that the assert() itself is not actually valid here.
hazelcast-cpp-client/hazelcast/src/hazelcast/cp/cp_impl.cpp
Lines 72 to 73 in 5978dfa
The assert checks if a new sessions_ map entry has been created, however create_new_session() is called by get_or_create_session() also if an existing session entry is found but it is invalid. In that case the map entry already exists and the assert will fail.
hazelcast-cpp-client/hazelcast/src/hazelcast/cp/cp_impl.cpp
Lines 61 to 63 in 5978dfa