|
|
058656 |
From 11cea14acfc11d0328013b61a3e1396e97dfe577 Mon Sep 17 00:00:00 2001
|
|
|
a66391 |
From: Thierry Bordaz <tbordaz@redhat.com>
|
|
|
058656 |
Date: Tue, 14 Nov 2017 16:29:03 +0100
|
|
|
a66391 |
Subject: [PATCH] Ticket 49410 - opened connection can remain no longer poll,
|
|
|
a66391 |
like hanging
|
|
|
a66391 |
|
|
|
a66391 |
Bug Description:
|
|
|
058656 |
Some opened connection are no longer poll.
|
|
|
058656 |
Those connections has 'gettingber' toggle set although there is
|
|
|
058656 |
no more worker thread reading it.
|
|
|
058656 |
The reason they have gettingber set is that the last
|
|
|
058656 |
operation had 'persistent search' flag. With such flag
|
|
|
058656 |
gettingber is not reset.
|
|
|
058656 |
persistent flag is set even when no persistent search/sync_repl
|
|
|
058656 |
was received on the connection.
|
|
|
058656 |
The problem is that the flag is tested on the wrong operation.
|
|
|
058656 |
The tested operation can be
|
|
|
058656 |
- the first operation when the connection entered in turbo mode
|
|
|
058656 |
- the previous operation if several ops PDUs were read on the network
|
|
|
058656 |
- accessing random memory
|
|
|
058656 |
|
|
|
058656 |
In theory testing the flag can lead to sigsev even
|
|
|
058656 |
if it never crash
|
|
|
a66391 |
|
|
|
a66391 |
Fix Description:
|
|
|
058656 |
The fix is to use the operation that is in the pblock
|
|
|
058656 |
In such case pb_op is no longer used, so we can get rid of it.
|
|
|
058656 |
In addition make pb_conn a local variable where it is used
|
|
|
a66391 |
|
|
|
a66391 |
https://pagure.io/389-ds-base/issue/49410
|
|
|
a66391 |
|
|
|
a66391 |
Reviewed by: Ludwig Krispenz, Mark Reynolds
|
|
|
a66391 |
|
|
|
a66391 |
Platforms tested: F26
|
|
|
a66391 |
|
|
|
a66391 |
Flag Day: no
|
|
|
a66391 |
|
|
|
a66391 |
Doc impact: no
|
|
|
a66391 |
---
|
|
|
058656 |
ldap/servers/slapd/connection.c | 7 +++----
|
|
|
058656 |
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
|
a66391 |
|
|
|
a66391 |
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
|
|
|
058656 |
index 24a7a1c05..3f19b9765 100644
|
|
|
a66391 |
--- a/ldap/servers/slapd/connection.c
|
|
|
a66391 |
+++ b/ldap/servers/slapd/connection.c
|
|
|
058656 |
@@ -1498,8 +1498,6 @@ connection_threadmain()
|
|
|
058656 |
int maxthreads = 0;
|
|
|
058656 |
int enable_nunc_stans = 0;
|
|
|
058656 |
long bypasspollcnt = 0;
|
|
|
058656 |
- Connection *pb_conn = NULL;
|
|
|
058656 |
- Operation *pb_op = NULL;
|
|
|
058656 |
|
|
|
058656 |
enable_nunc_stans = config_get_enable_nunc_stans();
|
|
|
058656 |
#if defined(hpux)
|
|
|
058656 |
@@ -1520,6 +1518,8 @@ connection_threadmain()
|
|
|
058656 |
}
|
|
|
a66391 |
|
|
|
058656 |
if (!thread_turbo_flag && !more_data) {
|
|
|
058656 |
+ Connection *pb_conn = NULL;
|
|
|
a66391 |
+
|
|
|
058656 |
/* If more data is left from the previous connection_read_operation,
|
|
|
058656 |
we should finish the op now. Client might be thinking it's
|
|
|
058656 |
done sending the request and wait for the response forever.
|
|
|
058656 |
@@ -1530,7 +1530,6 @@ connection_threadmain()
|
|
|
058656 |
* Connection wait for new work provides the conn and op for us.
|
|
|
058656 |
*/
|
|
|
058656 |
slapi_pblock_get(pb, SLAPI_CONNECTION, &pb_conn);
|
|
|
058656 |
- slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
|
|
|
058656 |
|
|
|
058656 |
switch (ret) {
|
|
|
058656 |
case CONN_NOWORK:
|
|
|
058656 |
@@ -1786,7 +1785,7 @@ connection_threadmain()
|
|
|
058656 |
/* total number of ops for the server */
|
|
|
058656 |
slapi_counter_increment(ops_completed);
|
|
|
058656 |
/* If this op isn't a persistent search, remove it */
|
|
|
058656 |
- if (pb_op->o_flags & OP_FLAG_PS) {
|
|
|
058656 |
+ if (op->o_flags & OP_FLAG_PS) {
|
|
|
058656 |
PR_EnterMonitor(conn->c_mutex);
|
|
|
058656 |
connection_release_nolock(conn); /* psearch acquires ref to conn - release this one now */
|
|
|
058656 |
PR_ExitMonitor(conn->c_mutex);
|
|
|
a66391 |
--
|
|
|
a66391 |
2.13.6
|
|
|
a66391 |
|