I would like to propose to switch to the new dependency sorting algorithm in glibc 2.35 (with a targeted backport). Backporting (at least) these commits should fix a long-standing performance issue in dlclose/process termination (bug 1159809, bug 1305145): commit 15a0c5730d1d5aeb95f50c9ec7470640084feae8 Author: Chung-Lin Tang <cltang> Date: Thu Oct 21 21:41:22 2021 +0800 elf: Fix slow DSO sorting behavior in dynamic loader (BZ #17645) commit 0884724a95b60452ad483dbe086d237d02ba624d Author: Florian Weimer <fweimer> Date: Tue Dec 14 12:37:44 2021 +0100 elf: Use new dependency sorting algorithm by default If we also backport the proposed change to disregard relocation dependencies: [PATCH 0/2] Predictable ELF destructor ordering <https://sourceware.org/pipermail/libc-alpha/2021-December/134165.html> we will fix bug 1133521. I think it would be safer to make these changes at 9 GA, so that Red Hat Enterprise Linux uses the new algorithm from the start.
(In reply to Florian Weimer from comment #0) > I think it would be safer to make these changes at 9 GA, so that Red Hat > Enterprise Linux uses the new algorithm from the start. As PO I approve of this change for RHEL9 GA. The change improves conformance for ISO C++. The order of destructors, particularly since no objects are unmapped until after all destructors run, should be possible to have as exactly the reverse order of constructors (as the change proposes). This has the benefit that it meets customer expectations and the ordering is not changed by the loader. The change is not an ABI change, so it could be changed if we determine there are customer requirements with existing binaries from RHEL7 and RHEL8. The only risk would be that specific workloads fail in this case, but we can evaluate that on a per-workload basis and adjust as required. None of this changes the existing semantics of STB_GNU_UNIQUE for C++. This is orthogonal to the new DSO sorting improvement upstream.
The destructor sorting changes have not yet landed upstream. So I'm going with the constructor sorting changes only.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (new packages: glibc), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:3917