Every of the script is based on assumption that you already read some library/unit whatever. But that is not enough. I wonder how you want to detect that you need restart in case that I have something like this:
$ ls foo.rb bar.rb
$ cat foo.rb
def some_function require 'bar' end
And now
1) I run some application, which loads my foo.rb file. 2) I later update the package which removes bar.rb file. 3) And I call some_function which fails due to missing bar.rb
There is no universal and reliable way how to detect this scenario IMO.
Vít
Dne 15.9.2014 10:06, Richard W.M. Jones napsal(a):
On Mon, Sep 15, 2014 at 09:50:36AM +0200, Miroslav Suchý wrote:
On 09/12/2014 07:09 PM, Reindl Harald wrote:
never worked relieable here on multiple machines
it often showed nothing where i knew the thing which should be restarted without looking and "lsof" proved it
I am one of those guys who refuse to reboot after each upgrade (and it works for me) and needs-restarting is ugly and insufficient to me.
Therefore I initiated this project: https://github.com/FrostyX/tracer http://copr.fedoraproject.org/coprs/frostyx/tracer/
It is still not finished and ready for announcement, but if you are looking for some other way than offline-upgrade, this might be worth of participating.
It wasn't clear to me how tracer works for non-C programs.
However there was some Red Hat only discussion recently about how to do this for Python programs, with minimal overhead. Below I'm just reproducing a technique (untested) that I think will work for Python.
It requires a small patch to the Python interpreter, and a similar patch to any other language interpreters (eg. Perl, Ruby).
Rich.
For each module (*.py or *.pyc) that it imports, have it mmap the first page of that file into its memory.
The mmap would be PROT_NONE because it's not actually used, and the associated file descriptor should be closed.
This will appear in /proc/PID/maps, with a "(deleted)" flag if the underlying file gets deleted (and hence the process needs restarting).
The cost should be almost nothing:
- 4K of virtual memory, no real memory
- an extra mmap syscall on import
- an extra segment in the kernel's VM AVL
Rich.