liske / needrestart

Restart daemons after library updates.
GNU General Public License v2.0
426 stars 67 forks source link

Use of uninitialized value $sdev in right bitshift #296

Open heapdavid opened 8 months ago

heapdavid commented 8 months ago

Hi, we run needrestart -b on a cron and occasionally see the following output to stderr on some of our busier servers. We're struggling to reproduce reliably as it's pretty rare and intermittent.

Use of uninitialized value $sdev in right bitshift (>>) at /usr/sbin/needrestart line 532, <HMAP> line 2.
Use of uninitialized value $sdev in right bitshift (>>) at /usr/sbin/needrestart line 532, <HMAP> line 2.
Use of uninitialized value $sdev in bitwise and (&) at /usr/sbin/needrestart line 532, <HMAP> line 2.
Use of uninitialized value $sdev in right bitshift (>>) at /usr/sbin/needrestart line 532, <HMAP> line 2.
Use of uninitialized value $sdev in right bitshift (>>) at /usr/sbin/needrestart line 532, <HMAP> line 2.
Use of uninitialized value $sdev in bitwise and (&) at /usr/sbin/needrestart line 532, <HMAP> line 2.
Use of uninitialized value $sdev in right bitshift (>>) at /usr/sbin/needrestart line 544, <HMAP> line 2.
Use of uninitialized value $sdev in right bitshift (>>) at /usr/sbin/needrestart line 544, <HMAP> line 2.
Use of uninitialized value $sinode in string eq at /usr/sbin/needrestart line 549, <HMAP> line 2

Have seen there was a similar issue a while ago but that looked to be fixed at the time.

We're running Debian 12 (Bookworm)

$ apt list needrestart
Listing... Done
needrestart/stable,now 3.6-4 all [installed]

Please let me know if you need any further information

Thanks

liske commented 7 months ago

Needrestart tries to compares the inode information from /proc/$PID/maps with the corresponding files in the filesystem. For some reasons the stat call seems to fail for some reasons: https://github.com/liske/needrestart/blob/c62b1529c5af3a78ad209ff942b289d4b4cdb45a/needrestart#L555

The path is the first available: at https://github.com/liske/needrestart/blob/c62b1529c5af3a78ad209ff942b289d4b4cdb45a/needrestart#L543-L544

Do you have any special filesystem setup? This might also happen if the process terminates while needrestart is investigating the procfs. :thinking: