Closed keif888 closed 2 days ago
@keif888 Thank you for your detailed report and fix! I have updated the entity.Update()
function based on this and would appreciate it if you could test these changes, see https://github.com/photoprism/photoprism/commit/be00bcf0b34d037d77360efc3e4a2c924fea1ebf.
1. What is not working as documented?
When issuing a call to the update photo api with location (latitude/longitude) changes, and the database has a lock timeout or a deadlock occur, the api fails silently and returns a http 200 response, but does NOT update the location information.
api: PUT call to /api/v1/photos/[photoid] body: {"Lat": 20.3456, "Lng":20,3456, "PlaceSrc": "manual"}
2. How can we reproduce it?
The steps below use the PhotoPrism app and the MariaDB client (or any other db client to connect to MariaDB) to reproduce the issue. I used the app in the reproduction as it uses the /api/v1/photos under the covers.
Steps to reproduce the behavior:
3. What behavior do you expect?
The api call should return a http 500 response if the update is unable to be applied. The app should have a pop up message to show that the update was not done.
4. What could be the cause of your problem?
photoprism/internal/entity/entity_update.go is not returning the error that is being generated by an update, but the lack of an error from an earlier database call (values, keys, err := ModelValues(m, keyNames...)). https://github.com/photoprism/photoprism/blob/98b0dc5e07ac80fe83b439478fe767f4760bc01a/internal/entity/entity_update.go#L32
It should be:
5. Can you provide us with example files for testing, error logs, or screenshots?
Log files showing a deadlock message, and the successful result message:
You can use any photo for testing, so long as it has labels against it. The reproduce steps above produce a lock timeout instead of a deadlock, but the code path followed within the PhotoPrism application is the same.
6. Which software versions do you use?
(a) PhotoPrism Architecture & Build Number: AMD64 - Build 240906-7792abf9a
(b) Database Type & Version: MariaDB 11.5.2
(c) Operating System Types & Versions: Linux Debian 12.7
(d) Browser Types & Versions: Chrome 128.0.6613.119 64 bit
(e) Ad Blockers, Browser Plugins, and/or Firewall Software - None, clean fresh install of everything. Extension Geolocation Plugin for PhotoPrism is installed.
7. On what kind of device is PhotoPrism installed?
This is especially important if you are reporting a performance, import, or indexing issue. You can skip this if you're reporting a problem you found in our public demo, or if it's a completely unrelated issue, such as incorrect page layout.
(a) Device / Processor Type: AMD Ryzen 7 5700X in VirtualBox (4 cores assigned) or Intel Core i3 540 in NAS
(b) Physical Memory & Swap Space in GB 8Gb ram, 16Gb swap for both
(c) Storage Type: HDD, SSD, RAID, USB, Network Storage,... SSD for Virtual Box HDD for NAS
(d) Anything else that might be helpful to know? I will try and put a Pull request to fix this issue, as I've already tested the code fix mentioned above.
8. Do you use a Reverse Proxy, Firewall, VPN, or CDN?
No