Thursday, March 29, 2018

[389-commits] [389-ds-base] 01/01: Ticket 48184 - revert previous patch around unuc-stans shutdown crash

This is an automated email from the git hooks/post-receive script.

mreynolds pushed a commit to branch master
in repository 389-ds-base.

commit fda63dc597956f93274274ba735f54d75fb777de
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Thu Mar 29 13:24:47 2018 -0400

Ticket 48184 - revert previous patch around unuc-stans shutdown crash

https://pagure.io/389-ds-base/issue/48184
---
ldap/servers/slapd/conntable.c | 13 --------
ldap/servers/slapd/daemon.c | 76 +++++++++++++++++-------------------------
ldap/servers/slapd/fe.h | 1 -
ldap/servers/slapd/slap.h | 1 -
4 files changed, 30 insertions(+), 61 deletions(-)

diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index 4fae174..62d5eac 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -91,19 +91,6 @@ connection_table_abandon_all_operations(Connection_Table *ct)
}
}

-void
-connection_table_disconnect_all(Connection_Table *ct)
-{
- for (size_t i = 0; i < ct->size; i++) {
- if (ct->c[i].c_mutex) {
- Connection *c = &(ct->c[i]);
- PR_EnterMonitor(c->c_mutex);
- disconnect_server_nomutex(c, c->c_connid, -1, SLAPD_DISCONNECT_ABORT, ECANCELED);
- PR_ExitMonitor(c->c_mutex);
- }
- }
-}
-
/* Given a file descriptor for a socket, this function will return
* a slot in the connection table to use.
*
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 3358f34..5d191fa 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1176,30 +1176,6 @@ slapd_daemon(daemon_ports_t *ports, ns_thrpool_t *tp)
housekeeping_stop(); /* Run this after op_thread_cleanup() logged sth */
disk_monitoring_stop();

- /*
- * Now that they are abandonded, we need to mark them as done.
- * In NS while it's safe to allow excess jobs to be cleaned by
- * by the walk and ns_job_done of remaining queued events, the
- * issue is that if we allow something to live past this point
- * the CT is freed from underneath, and bad things happen (tm).
- *
- * NOTE: We do this after we stop psearch, because there could
- * be a race between flagging the psearch done, and users still
- * try to send on the connection. Similar with op_threads.
- */
- connection_table_disconnect_all(the_connection_table);
-
- /*
- * WARNING: Normally we should close the tp in main
- * but because of issues in the current connection design
- * we need to close it here to guarantee events won't fire!
- *
- * All the connection close jobs "should" complete before
- * shutdown at least.
- */
- ns_thrpool_shutdown(tp);
- ns_thrpool_wait(tp);
-
threads = g_get_active_threadcnt();
if (threads > 0) {
slapi_log_err(SLAPI_LOG_INFO, "slapd_daemon",
@@ -1652,18 +1628,25 @@ ns_handle_closure(struct ns_job_t *job)
Connection *c = (Connection *)ns_job_get_data(job);
int do_yield = 0;

+/* this function must be called from the event loop thread */
+#ifdef DEBUG
+ PR_ASSERT(0 == NS_JOB_IS_THREAD(ns_job_get_type(job)));
+#else
+ /* This doesn't actually confirm it's in the event loop thread, but it's a start */
+ if (NS_JOB_IS_THREAD(ns_job_get_type(job)) != 0) {
+ slapi_log_err(SLAPI_LOG_ERR, "ns_handle_closure", "Attempt to close outside of event loop thread %" PRIu64 " for fd=%d\n",
+ c->c_connid, c->c_sd);
+ return;
+ }
+

No comments:

Post a Comment