Skip to content

python dependency scan races with script exit #347

@tik-stbuehler

Description

@tik-stbuehler

When the python script already terminated once the scan completes, it shows all python modules as uses obsolete script file(s):.

I think this happens here:

my %ret = map {
my $stat = nr_stat("/proc/$pid/root/$_");
$_ => ( defined($stat) ? $stat->{ctime} : undef );
} keys %files;

"/proc/$pid/root/..." is already gone cause the process is gone, so it will show all files with a missing timestamp, and I guess the main handler doesn't like this?

Inserting this after the block above seems to "fix" it:

%ret = () unless -d "/proc/$pid/root";  # ignore everything if process is already gone

It might be a good idea to generically ignore all processes that are already gone (no idea whether other interpreter modules have the same issue).

Context: debian trixie, running a lot of python scripts in icinga2 context (checks), and needrestart often wants to restart icinga due to python scripts that "use obsolete file(s)" (all false positives).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions