|
|
Log in / Subscribe / Register

Shared libraries

Shared libraries

Posted Nov 25, 2025 6:53 UTC (Tue) by josh (subscriber, #17465)
In reply to: Shared libraries by Cyberax
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?

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.


to post comments

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