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

Occasional assertion failure in hazelcast::cp::internal::session::proxy_session_manager::create_new_session() [API-1501] #1005

Closed
bjd opened this issue Aug 11, 2022 · 1 comment · Fixed by #1027
Assignees
Labels
Source: Community to-jira Use to create a placeholder Jira issue in Jira APIs Project Type: Defect
Milestone

Comments

@bjd
Copy link

bjd commented Aug 11, 2022

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);
}

@hakanaktas0 hakanaktas0 added the to-jira Use to create a placeholder Jira issue in Jira APIs Project label Aug 11, 2022
@github-actions
Copy link

Internal Jira issue: API-1501

@github-actions github-actions bot changed the title Occasional assertion failure in hazelcast::cp::internal::session::proxy_session_manager::create_new_session() Occasional assertion failure in hazelcast::cp::internal::session::proxy_session_manager::create_new_session() [API-1501] Aug 11, 2022
@ihsandemir ihsandemir added this to the 5.1.0 milestone Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Community to-jira Use to create a placeholder Jira issue in Jira APIs Project Type: Defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants