Skip to content

Issue 6119 - Synchronise accept_thread with slapd_daemon #6120

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

Merged
merged 2 commits into from
Mar 8, 2024

Conversation

jchapma
Copy link
Contributor

@jchapma jchapma commented Mar 6, 2024

Bug Description: A corner cases exists, where the slapd_daemon has begun its shutdown process but the accept_thread is still running and capable of handling new connections. When this scenario occurs, the connection subsystem has been partially deallocated and is in an unstable state. A segfault is generated when attempting to get a new connection from the connection table.

Fix Description: The connection table is only deallocated when the number of active threads is 0. Modify the accept_thread to adjust the the active thread count during creation/destruction, meaning the connection table can only be freed when the accept_thread has completed

Relates: #6119

Reviewed by:

Bug Description: A corner cases exists, where the slapd_daemon has
begun its shutdown process but the accept_thread is still running
and capable of handling new connections. When this scenario occurs,
the connection subsystem has been partially deallocated and is in
an unstable state. A segfault is generated when attempting to get a
new connection from the connection table.

Fix Description: The connection table is only deallocated when the
number of active threads is 0. Modify the accept_thread to adjust the
the active thread count during creation/destruction, meaning the connection
table can only be freed when the accept_thread has completed

Relates: 389ds#6119

Reviewed by:
@jchapma jchapma added the work in progress Work in Progress - can be reviewed, but not ready for merge. label Mar 6, 2024
Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -1158,6 +1160,8 @@ slapd_daemon(daemon_ports_t *ports)
slapi_log_err(SLAPI_LOG_EMERG, "slapd_daemon", "Unable to fd accept thread - Shutting Down (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)\n",
errorCode, slapd_pr_strerror(errorCode));
g_set_shutdown(SLAPI_SHUTDOWN_EXIT);
} else{
g_incr_active_threadcnt();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation :-)

@jchapma jchapma merged commit 1d73b8a into 389ds:main Mar 8, 2024
@jchapma
Copy link
Contributor Author

jchapma commented Mar 8, 2024

I will cherry pick back to relevant branches on Monday

jchapma added a commit that referenced this pull request Apr 10, 2024
Bug Description: A corner cases exists, where the slapd_daemon has
begun its shutdown process but the accept_thread is still running
and capable of handling new connections. When this scenario occurs,
the connection subsystem has been partially deallocated and is in
an unstable state. A segfault is generated when attempting to get a
new connection from the connection table.

Fix Description: The connection table is only deallocated when the
number of active threads is 0. Modify the accept_thread to adjust the
the active thread count during creation/destruction, meaning the connection
table can only be freed when the accept_thread has completed

Relates: #6119

Reviewed by: @tbordaz, @Firstyear , @mreynolds389  (Thank you)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress Work in Progress - can be reviewed, but not ready for merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants