It looks like thread 5 runs amok in sql_dbconn_mutex() while locking sql_dbconn_mutex. That mutex lacks an unlock operation in 2.3.38 where slapd logs "backsql_open_db_conn(...): duplicate connection ID". (Which doesn't sound too good to me either, but then I don't know back-sql.) If that's the problem, it was fixed in OpenLDAP 2.3.39 for ITS#5095.