ldap/servers/plugins/replication/repl5_connection.c | 2 +-
ldap/servers/plugins/replication/repl5_protocol.c | 4 ++--
ldap/servers/slapd/ldaputil.c | 18 +++++++++++++++---
3 files changed, 18 insertions(+), 6 deletions(-)
New commits:
commit 3e8c2a470941365e72073870513e56e085aeb96d
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Wed Apr 10 18:45:17 2013 +0200
Ticket 47325 - Crash at shutdown on a replica aggrement
Bug Description:
This is a followup of the ticket
https://fedorahosted.org/389/ticket/618
The RA thread are waited by the main daemon at shutdown.
The problem is that the RA thread are not created with the right flag so they are
not
joinable.
Fix Description:
Use the correct creation flag PR_JOINABLE_THREAD
In addition this fix introduce a bind timeout for the RA. It will take the one
defined in
the protocol (10 min per default).
Ticket:
https://fedorahosted.org/389/ticket/47325
Reviewed by: Mark Reynolds (thank you Mark !)
Platforms tested: Fedora 17
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/repl5_connection.c
b/ldap/servers/plugins/replication/repl5_connection.c
index b8b542e..668abda 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -1782,7 +1782,7 @@ bind_and_check_pwp(Repl_Connection *conn, char * binddn, char
*password)
const char *mech = bind_method_to_mech(conn->bindmethod);
rc = slapi_ldap_bind(conn->ld, binddn, password, mech, NULL,
- &ctrls, NULL, NULL);
+ &ctrls, &conn->timeout, NULL);
if ( rc == LDAP_SUCCESS )
{
diff --git a/ldap/servers/plugins/replication/repl5_protocol.c
b/ldap/servers/plugins/replication/repl5_protocol.c
index 76e018a..8373ba6 100644
--- a/ldap/servers/plugins/replication/repl5_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_protocol.c
@@ -369,9 +369,9 @@ prot_start(Repl_Protocol *rp)
{
rp->agmt_thread = PR_CreateThread(PR_USER_THREAD, prot_thread_main,
(void *)rp,
#if defined(__hpux) && defined(__ia64)
- PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 524288L );
+ PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 524288L );
#else
- PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD,
SLAPD_DEFAULT_THREAD_STACKSIZE);
+ PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD,
SLAPD_DEFAULT_THREAD_STACKSIZE);
#endif
if (rp->agmt_thread == NULL)
{
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 3ca1139..5ac2fdd 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -1126,7 +1126,19 @@ slapi_ldap_bind(
if (msgidp) { /* let caller process result */
*msgidp = mymsgid;
} else { /* process results */
- rc = ldap_result(ld, mymsgid, LDAP_MSG_ALL, timeout, &result);
+ struct timeval default_timeout, *bind_timeout;
+
+ if ((timeout == NULL) || ((timeout->tv_sec == 0) &&
(timeout->tv_usec == 0))) {
+ /* Let's wait 1 min max to bind */
+ default_timeout.tv_sec = 60;
+ default_timeout.tv_usec = 0;
+
+ bind_timeout = &default_timeout;
+ } else {
+ /* take the one provided by the caller. It should be the one defined
in the protocol */
+ bind_timeout = timeout;
+ }
+ rc = ldap_result(ld, mymsgid, LDAP_MSG_ALL, bind_timeout, &result);
if (-1 == rc) { /* error */
rc = slapi_ldap_get_lderrno(ld, NULL, NULL);
slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_bind",
@@ -1141,8 +1153,8 @@ slapi_ldap_bind(
slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_bind",
"Error: timeout after [%ld.%ld] seconds reading "
"bind response for [%s] authentication mechanism [%s]\n",
- timeout ? timeout->tv_sec : 0,
- timeout ? timeout->tv_usec : 0,
+ bind_timeout ? bind_timeout->tv_sec : 0,
+ bind_timeout ? bind_timeout->tv_usec : 0,
bindid ? bindid : "(anon)",
mech ? mech : "SIMPLE");
goto done;
commit cf0249ac55a7f5e61ed94fd8bfc1e1a00ac4a273
Merge: c7fc203 78f029f
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Mon Apr 29 15:12:01 2013 +0200
Merge branch '389-ds-base-1.3.1' of
ssh://git.fedorahosted.org/git/389/ds into
389-ds-base-1.3.1
commit c7fc203ffe09809e430ff1217ec352db95d636a0
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Apr 24 11:44:40 2013 -0600
Ticket #47348 - add etimes to per second/minute stats
https://fedorahosted.org/389/ticket/47348
Reviewed by: mreynolds (Thanks!)
Branch: 389-ds-base-1.3.1
Fix Description: Add an "ElapsedTime" column to the -m/-M output. This
column
is the cumulative etimes of all operations during that time period.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: yes
(cherry picked from commit 9813b219ad2aa7b7194d9295dd529e12889a8534)
Ticket #47349 - DS instance crashes under a high load
https://fedorahosted.org/389/ticket/47349
Reviewed by: nkinder (Thanks!)
Branch: 389-ds-base-1.3.1
Fix Description: handle_new_connection initializes the connection object,
then calls connection_table_move_connection_on_to_active_list to put it
on the list of active connections, then unlocks the c_mutex, then calls
connection_new_private to allocate c_private. If another thread
interrupts after the conn has been moved to the active list, but before
c_private has been allocated, the new conn will be available via
connection_table_iterate_active_connections where table_iterate_function
will attempt to dereference the NULL c_private.
The fix is to move connection_new_private inside the c_mutex lock, and to
move connection_table_move_connection_on_to_active_list to be the very last
thing before releasing the c_mutex lock. Once the conn is on the active
list it is live and we cannot do anything else to it.
Note: I have still not been able to reproduce the problem in a non-debug
optimized build.
Platforms tested: RHEL6 x86_64
Note: Before patch, server would crash within 5 minutes. After patch, server
has been running for several days in customer environment.
Flag Day: no
Doc impact: no
(cherry picked from commit 05d209432571dc64b242ae47113ae4cbb43607d2)
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
index 3b8adc5..efc5970 100755
--- a/ldap/admin/src/logconv.pl
+++ b/ldap/admin/src/logconv.pl
@@ -2042,7 +2042,7 @@ sub parseLineNormal
if ($1 ne "0"){ $errorCount++;}
else { $successCount++;}
}
- if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1);}
+ if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1);
inc_stats_val('etime',$1,$s_stats,$m_stats); }
if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){
if ($_ =~ / nentries= *([0-9]+)/i ){ writeFile($NENTRIES, $1); }
}
@@ -2197,6 +2197,7 @@ reset_stats_block
$stats->{'anonbind'}=0;
$stats->{'unbind'}=0;
$stats->{'notesu'}=0;
+ $stats->{'etime'}=0;
return;
}
@@ -2241,12 +2242,13 @@ print_stats_block
$stats->{'bind'},
$stats->{'anonbind'},
$stats->{'unbind'},
- $stats->{'notesu'} ),
+ $stats->{'notesu'},
+ $stats->{'etime'}),
"\n" );
} else {
$stats->{'fh'}->print(
"Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,".
- "Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed\n"
+ "Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed,ElapsedTime\n"
);
}
}
@@ -2265,6 +2267,20 @@ inc_stats
return;
}
+# like inc_stats, but increments the block counter with the given value e.g.
+# 'statname1', val, statblock1, statblock2, ...
+sub
+inc_stats_val
+{
+ my $n = shift;
+ my $val = shift;
+ foreach(@_){
+ $_->{$n} += $val
+ if exists $_->{$n};
+ }
+ return;
+}
+
sub
displayBindReport
{
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index fa19312..66677d2 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -2686,16 +2686,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc
*pr_acceptfd, i
/* Call the plugin extension constructors */
conn->c_extension = factory_create_extension(connection_type,conn,NULL /* Parent
*/);
-
- /* Add this connection slot to the doubly linked list of active connections. This
- * list is used to find the connections that should be used in the poll call. This
- * connection will be added directly after slot 0 which serves as the head of the list
*/
- if ( conn != NULL && conn->c_next == NULL && conn->c_prev == NULL
)
- {
- /* Now give the new connection to the connection code */
- connection_table_move_connection_on_to_active_list(the_connection_table,conn);
- }
-
#if defined(ENABLE_LDAPI)
#if !defined( XP_WIN32 )
/* ldapi */
@@ -2708,10 +2698,21 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc
*pr_acceptfd, i
#endif
#endif /* ENABLE_LDAPI */
- PR_Unlock( conn->c_mutex );
-
connection_new_private(conn);
+ /* Add this connection slot to the doubly linked list of active connections. This
+ * list is used to find the connections that should be used in the poll call. This
+ * connection will be added directly after slot 0 which serves as the head of the list.
+ * This must be done as the very last thing before we unlock the mutex, because once it
+ * is added to the active list, it is live. */
+ if ( conn != NULL && conn->c_next == NULL && conn->c_prev == NULL
)
+ {
+ /* Now give the new connection to the connection code */
+ connection_table_move_connection_on_to_active_list(the_connection_table,conn);
+ }
+
+ PR_Unlock( conn->c_mutex );
+
g_increment_current_conn_count();
return 0;