leiweibau / Pi.Alert

Scan the devices connected to your WIFI / LAN and alert you the connection of unknown devices. It also warns if a "always connected" device disconnects. In addition, it is possible to check web services for availability. For this purpose HTTP status codes and the response time of the service are evaluated.
https://leiweibau.net
GNU General Public License v3.0
428 stars 31 forks source link

[Bug] Possible DB corruption while performing DB backup with scans off #258

Closed johnny-tknoska closed 7 months ago

johnny-tknoska commented 7 months ago

Hi! First of all, congratulations on your excellent work with Pi.Alert. It's a fantastic tool. I'm new to this, but I've been reviewing the functionality and some of the code, and I believe I've found a bug:

When you pause the scans for a specific time (10 minutes, 15, etc.) in Settings, the ARP scans indeed stop, but none of the other scans (neither the Internet IP scans nor the Speedtests). I haven't tested the rest of the scans, but based on the code, it seems they wouldn't stop either.

This could be a problem if, for example, a DB backup is being performed just at the moment when it's scanning the Internet IP and detects a change or doing a Speedtest, recording results in the DB, potentially leading to DB corruption. In the text next to the "Toggle Scans (on/off)" button, it indicates "Switches all scans of Pi.Alert on or off," but this is not the case. It only stops the ARP scans, and the rest remain active, potentially causing DB corruption if a change occurs in the other scans while a DB backup is in progress.

Thank you again for your great work!

leiweibau commented 7 months ago

Thanks for the kind words.

When you pause the scans for a specific time (10 minutes, 15, etc.) in Settings, the ARP scans indeed stop, but none of the other scans (neither the Internet IP scans nor the Speedtests).

Of course, you're right. I still need to make adjustments here. This function is not only important for the backup, but also for the update. Thanks for the hint.

leiweibau commented 7 months ago

Update released with https://github.com/leiweibau/Pi.Alert/commit/c96da56cd10c277feca9c36fc1b45e715f00bf2b