You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When NuRaft encounters an unrecoverable state it calls exit(2) directly, such as:
// handle_commit.cxx160boolraft_server::commit_in_bg_exec(size_t timeout_ms) {
...
225 ptr<log_entry> le = log_store_->entry_at(index_to_commit);
226if (!le)
227 {
228// LCOV_EXCL_START229p_ft( "failed to get log entry with idx %" PRIu64 "", index_to_commit );
230 ctx_->state_mgr_->system_exit(raft_err::N19_bad_log_idx_for_term);
231::exit(-1);
232// LCOV_EXCL_STOP233 }
commit_bg_exec runs in a separate thread from the main process which could also have other threads or even other nuraft::raft_server's running. This forceful termination does not allow the process to try and enter a "non-random" state and behaves as if every thread abnormally terminated.
Requested is that pthread_exit(3) be used instead after a call to state_mgr::system_exit to announce that the server is going to stop processing. The main process can decide whether to also terminate and join all other threads normally, continue after abandoning this raft service or abend itself.
The text was updated successfully, but these errors were encountered:
szmyd
changed the title
Should use pthread_exit instead of exit to allow proper process shutdown.
Use pthread_exit instead of exit to allow proper process shutdown.
Sep 12, 2024
szmyd
added a commit
to szmyd/NuRaft
that referenced
this issue
Sep 12, 2024
* Use pthread_exit to terminate raft service.
Allow the process to handle termination of raft service rather than
force process wide `exit()`. This is compile time configurable during CMake configuration.
Addresses #535
---------
Co-authored-by: Jung-Sang Ahn <jungsang.ahn@gmail.com>
When NuRaft encounters an unrecoverable state it calls
exit(2)
directly, such as:commit_bg_exec
runs in a separate thread from themain
process which could also have other threads or even other nuraft::raft_server's running. This forceful termination does not allow the process to try and enter a "non-random" state and behaves as if every thread abnormally terminated.Requested is that
pthread_exit(3)
be used instead after a call tostate_mgr::system_exit
to announce that the server is going to stop processing. The main process can decide whether to also terminate andjoin
all other threads normally, continue after abandoning this raft service or abend itself.The text was updated successfully, but these errors were encountered: