Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 2.34 KB

File metadata and controls

18 lines (13 loc) · 2.34 KB

BZ-17645 Patch

Summary

This patch resolves a performance issue that affects MATLAB and Simulink shutdown performance. The patch provides a new sorting algorithm for shared objects in the dynamic loader. The original algorithm in glibc versions prior to glibc 2.35 is slow when the DSO set contains circular dependencies.

If you are running

  • ubuntu-based systems and can upgrade to version 22.04 (Jammy Jellyfish) this is the safest and easiest way to alleviate the issue, since that version contains glibc v2.35 in which the underlying issue is completely fixed.
  • RHEL8-based systems (update 06 June 2023). It appears that RHEL have patched the glibc-2.28 packages in release 225 to fix this issue. Ensure that you have installed at least glibc-2.28-225.el8.

Bug Description

The performance issue impacts the MATLAB and Simulink shutdown time. In a Debian 11 environment using glibc 2.31, the MATLAB and Simulink shutdown time is about 300 seconds with modern hardware. With the same setup and the patch enabled, the shutdown time is less than 3 seconds. The performance issue was first reported in November of 2014 by Paulo Andrade. For more information, see RFE: Improve performance of dynamic loader for deeply nested DSO dependencies.

Patch Sources

This patch contains a new implementation of _dl_sort_maps, which Paulo Andrade introduced in RFE: Improve performance of dynamic loader for deeply nested DSO dependencies. Chung-Lin Tang cltang@codesourcery.com and Adhemerval Zanella azanella@sourceware.org later incorporated the new implementation into the master branch of glibc 2.35 in the commit elf: Fix slow DSO sorting behavior in dynamic loader (BZ #17645).

The MathWorks BZ-17645 patch sets the new DFS sorting algorithm as the default behavior.

Acknowledgements and Thanks

Many thanks to the glibc team and, particularly, Paulo Andrade for reporting the issue and providing the original implementation and Chung-Lin Tang and Adhemerval Zanella for incorporating the new sorting algorithm into glibc 2.35 and providing the original patch.