[Bug] no more scans?
For the past 5 days, I haven't received any new devices or down notifications. A reboot did not fix the issue. The scan log contains the following :
Pi.Alert v2024-09-01
---------------------------------------------------------
Executing user: stanelie
Scan Devices
Timestamp: 2024-09-12 17:35:00
Scanning...
arp-scan Method...
arp-scan: One interface
Pi-hole 5 Method...
Traceback (most recent call last):
File "/home/stanelie/pialert/back/pialert.py", line 3609, in
sys.exit(main())
^^^^^^
File "/home/stanelie/pialert/back/pialert.py", line 96, in main
res = scan_network()
^^^^^^^^^^^^^^
File "/home/stanelie/pialert/back/pialert.py", line 735, in scan_network
copy_pihole_network()
File "/home/stanelie/pialert/back/pialert.py", line 913, in copy_pihole_network
sql.execute ("DELETE FROM PiHole_Network")
sqlite3.OperationalError: attempt to write a readonly database
I stopped the scan service with the web GUI, I deleted the -wal and -shm files, and I restarted the scan. I now works again.
What can be done to make this more reliable? Thanks
I suspect that the accesses of the backend user and the frontend are getting in each other's way. I can implement an experimental function that also changes the permissions of the transaction files. I would then instruct you how to activate the code to see if the situation improves.
Great, I will try!
As announced, the current update contains experimental code. Please comment out these lines (# at the beginning of the line)
https://github.com/leiweibau/Pi.Alert/blob/cb5e43ed643e596ff789b9645db9bd749114e8c1/back/pialert.py#L133-L134
For these lines, remove the leading “# ” (including the space to the right of it) https://github.com/leiweibau/Pi.Alert/blob/cb5e43ed643e596ff789b9645db9bd749114e8c1/back/pialert.py#L137-L138
You will find the file “pialert.py” in the directory “pialert/back/”
I've modified the required lines. Do I need to do anything else to "apply" this modification?
Do I need to do anything else to "apply" this modification?
no
So far, it's a lot better! I have not had to stop the scanning engine to be able to edit entries since I applied this test permissions modifications.
There was not a lot of new activity on the network though, but so far, so good!
Thanks again, this makes pi.alert a lot more useable for me!
I spoke too fast, I just had to stop the scanning engine to be able to edit 3 devices. So, better, but not bulletproof.
stop the scanning engine to be able to edit 3 devices
The experimental code was not intended to counteract this behavior and cannot work at all. According to the idea, the code should only help if transaction data of the www-data user is still open and the scan forces the user permissions on the user under which Pi.Alert is installed. The database gives the response “Database locked” of its own accord. Or to put it another way: The code should be used to test whether the error that you have to delete these two files for anything to work at all becomes less frequent, or even disappears.
The original Pi.Alert was not at all suitable for constant editing while scans should also be constantly running, nor is the version I have continued, which is simply due to the database technology.
Then, I would say the errors are less frequent.
After the update, you should reactivate the experimental function in script
I commented out lines 137-138, and uncommented lines 141-142.
With the next update, the function I added for testing will be active by default
Update released with https://github.com/leiweibau/Pi.Alert/commit/4317ae53a4af619ce48b14248c85733684539201