|
|
Log in / Subscribe / Register

Shared libraries

Shared libraries

Posted Nov 25, 2025 0:51 UTC (Tue) by Cyberax (✭ supporter ✭, #52523)
In reply to: Shared libraries by bluca
Parent article: APT Rust requirement raises questions

But how do you make sure that a "Component A" works if the "Library B" was replaced while "Component A" is running? Especially for daemons that can stay up for a long time.

It's so much better to precompile everything into "Component A", so that it need not care if anything on disk changes.


to post comments

Shared libraries

Posted Nov 25, 2025 6:48 UTC (Tue) by koflerdavid (subscriber, #176408) [Link] (4 responses)

Is that really such a big issue with existing packaging? Library B should still be resident in memory and therefore Component A will keep running. If Component A is incompatible with the new version of Library B then Component A needs to be updated and restarted as well of course.

Atomic distributions handle this by creating a new file system image in the background, and the user boots into the updated system.

Shared libraries

Posted Nov 25, 2025 9:06 UTC (Tue) by taladar (subscriber, #68407) [Link] (3 responses)

From practical experience on both my desktop (Gentoo) and various servers (Debian and RHEL) crashes and misbehaving programs due to updated dependencies happen all the time, I encounter one at least 1-2 times a week. Granted, it is not always the library part that is the problem but often files that weren't in memory at all at the time of the update that the library assumes it can load but the end result is the same.

Shared libraries

Posted Nov 25, 2025 14:37 UTC (Tue) by NightMonkey (subscriber, #23051) [Link] (1 responses)

From my experience, Gentoo does a great job of recompiling packages that need shared library updates. :shrug: Perhaps you need to change your upgrading patterns? :)

For example, I use this to upgrade religiously:

emerge -uDNv --with-bdeps y system world --keep-going --jobs --load-average 8

Shared libraries

Posted Nov 26, 2025 9:08 UTC (Wed) by taladar (subscriber, #68407) [Link]

My update command is quite similar only I don't use binary dependencies but what does that have to do with the problem I talked about of programs not being restarted and the distro tools themselves not mentioning the required restart?

Shared libraries

Posted Nov 25, 2025 15:26 UTC (Tue) by ballombe (subscriber, #9523) [Link]

This is very unusual, otherwise Debian would be flooded by bug reports.

Shared libraries

Posted Nov 25, 2025 6:53 UTC (Tue) by josh (subscriber, #17465) [Link] (6 responses)

> But how do you make sure that a "Component A" works if the "Library B" was replaced while "Component A" is running?

Whether you're dealing with a replacement of component A, or a replacement of library B, either way, you *always* write to a temporary file and rename over the original, so that the old inode still exists as the source of the mmap'd code, and then restart A. Writing over the original will cause segfaults.

Shared libraries

Posted Nov 25, 2025 9:08 UTC (Tue) by taladar (subscriber, #68407) [Link] (2 responses)

Oddly enough none of the distros like Debian include a core component that checks which A needs to be restarted after upgrades. We have been using needrestart for that for years but it seems like a problem none of the distros even attempt to solve.

Shared libraries

Posted Nov 25, 2025 12:03 UTC (Tue) by draco (subscriber, #1792) [Link]

Fedora Server edition installs Cockpit, which uses needrestart. Though it still waits for the admin to invoke the restarts.

Shared libraries

Posted Nov 25, 2025 19:18 UTC (Tue) by bluca (subscriber, #118303) [Link]

Shared libraries

Posted Nov 25, 2025 18:12 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link] (2 responses)

Won't help. The binary of "Component A" might not have loaded the library at the time of the replacement.

This is not theoretical, that's how new systemd behaves. It loads libraries dynamically using dlopen().

Shared libraries

Posted Nov 26, 2025 9:14 UTC (Wed) by taladar (subscriber, #68407) [Link] (1 responses)

This is not just a library issue either, it can also happen with data files or helper binaries that communicate via entirely different interfaces (e.g. browser tab helper processes).

Depending on the design of the program it might even happen if you make a config change and some more recently loaded part of the whole package (library, binary,...) reads the new configuration and the longer running parts use the old.

Sometimes that is even deliberate as part of some reload mechanism where a new binary loads a new config, then gets file handles for sockets and similar resources from the old binary so even using something like a snapshot of the filesystem from the time the first part of the package is started wouldn't be a universal solution.

Shared libraries

Posted Nov 26, 2025 18:43 UTC (Wed) by Cyberax (✭ supporter ✭, #52523) [Link]

Indeed. But we actually have pretty good "ABI layers" for IPC. Everything from OpenAPI to Protobuf/CapnProto descriptions.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds