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
342 stars 25 forks source link

Periodic error writing to the database when it is in read-only mode #232

Closed njacobson-hrp closed 6 months ago

njacobson-hrp commented 6 months ago

Sometimes when I try to save a device (although it probably happens with any action that writes to the database) I get an error. On my laptop, the error message starts with the failed SQL query but is truncated before I can see the actual error text. On my phone, I can see the full error which says it is trying to write to a read-only database. Not directly related to the issue, but I would recommend not including the SQL code in the error message for the user especially since it is truncated on some devices.

If I wait about a minute or so, I can eventually save the record successfully and make any other database changes for a period of time. My guess is that this is related to when the app is performing a scan, but I haven't investigated enough yet to know. I tried to see if other people are experiencing this issue, but the only references were to database permission errors which is unlikely to be my issue since it is transient.

leiweibau commented 6 months ago

My guess is that this is related to when the app is performing a scan,

Yes, this can happen when a scan is running. And since the scan runs periodically, this effect can also occur periodically. SQLite is not a multiuser database. If the devices are being edited extensively, it is advisable to deactivate the scan for the duration of the editing process. The normal case is that mostly Pi.Alert writes to the database and not the user via the web interface. This usually has mostly read access.

leiweibau commented 6 months ago

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

I have added or reworded the text on the Help/FAQ page.