When LDAP connection pooling is enabled, the server tracks the average latency for operations on each LDAP host and stores it in a struct called LDAPHostTimingData. This structure is shared between all PooledLDAPConnections that are connected to that particular host and a global LDAPPoolTimingData struct that maintains an unordered map of shared_ptrs to this timing data.
When these shared_ptrs are accessed via the LDAPPoolTimingData map, they are synchronized via a mutex. They are only used in this context for reads. However, writes to each LDAPHostTimingData occur from within the PooledLDAPConnections themselves, which do not use that mutex to synchronize their writes with reads.
As a result, it is possible for the comparator used in this stable sort to become inconsistent as values are updated while the comparator is being called by the sorting algorithm. std::stable_sort causes undefined behavior if the comparator does not return deterministic answers throughout the lifetime of the sort, and it's very possible that this is responsible for some crashes that have been seen during this sort in HELP tickets.