News for hackers. Stuff that matters.
Re:Ubuntu: “How are we improving Firefox snap performance?” by chrisseaton on Saturday September 03, 2022 @11:49AM (#32703011)
How is APT able to update the code of a running process?
Re:Ubuntu: “How are we improving Firefox snap performance?” by mort96 on Saturday September 03, 2022 @11:59AM (#32703143)
It unlinks the old file paths and creates new ones in their place. Files in Linux are reference counted, and they're only actually marked as deleted on disk once the reference count goes to 0; a directory entry is one reference, but the running process is also a reference, so even though the path /usr/bin/firefox has been replaced with a new file, the old file is still in use by the existing Firefox process. When you stop Firefox, the refcount for the old file will drop to 0, and when you start it again, the new /usr/bin/firefox will be launched.

The same idea applies to all libraries, where the old version of say /usr/lib/firefox/libxul.so can still be referenced by the running firefox process even after apt has replaced it with a new version.

It's not a great system honestly, Firefox will launch new processes sometimes and the IPC system kinda breaks down when the parent process and the child process are from different Firefox versions.

Re:Ubuntu: “How are we improving Firefox snap performance?” by bogwog on Saturday September 03, 2022 @11:55AM (#32703087)
I'm not sure of the details, but when you update a running Firefox all your currently-open tabs continue to work, but when you try to open a new one you'll get an error message telling you that you need to restart Firefox to keep using it.
Re:Ubuntu: “How are we improving Firefox snap performance?” by chrisseaton on Saturday September 03, 2022 @11:57AM (#32703110)
Ah right I thought you meant it did some kind of hot-patching - sounds like it still needs a hard restart like normal.