photos icon indicating copy to clipboard operation
photos copied to clipboard

Temp dir filled with /tmp/nextcloud_photos_* files

Open danielmarschall opened this issue 1 year ago • 2 comments

I have a lot of temp files in /tmp:

-rw------- 1 nextcloud         nextcloud         3,8M 17. Sep 01:10  nextcloud_photos_d9Ym8N
-rw------- 1 nextcloud         nextcloud         3,8M 17. Sep 02:10  nextcloud_photos_DMM0Wq
-rw------- 1 nextcloud         nextcloud         3,8M 24. Sep 23:45  nextcloud_photos_emig0d
-rw------- 1 nextcloud         nextcloud         3,8M 25. Sep 01:05  nextcloud_photos_fk7kzY

All have the same content.

Searching the code for nextcloud_photos_, I can see that in apps/photos/lib/Service/ReverseGeoCoderService.php the file was created in the following methods:

  • ReverseGeoCoderService::buildKDTree()
  • ReverseGeoCoderService::loadKdTree()

I do not see that the temp file gets deleted. Maybe I missed it, or they are actually never deleted.

Current system: nextcloud 27.1.2 on Debian 12 with PHP 8.2.7

danielmarschall avatar Oct 06 '23 23:10 danielmarschall

Same Problem here. NC 26.0.7 / Photos 2.2.0 / PHP 8.2.11 on Debian 12. Got 12 instances of the same file with different suffixes since cleaning of /tmp yesterday.

Why there is the temporary copy of the cities1000.bin in loadKdTree() ? The FSKDTree constructor opens the file only read-only. For updating (via cron, but once per day should be enough) while other requests active it may be better to create the new file with a temp name, delete the original file and rename the temp file. The temp file should be in the same folder for this, because the sys_temp_dir is maybe on a different storage, so renaming / moving needs time if used.

May I ask why you don't put the geodata in the database and use SQL to get the nearest city ? Using "power(latitude-$lat,2)+power(longitude-$lon,2)" sort descending limit to 1 should do it for the nearest city?

alx-tuilmenau avatar Oct 10 '23 10:10 alx-tuilmenau

Some problem here. NC 28.01 / php 8.2.14 on Ubuntu 22.04

/tmp directory filled timewise with "nextcloud_photos_xxxxx" files. All the same size 3,8 M.

I just solve the problem for myself, that I installed a cron job to delete "tmp-files" like this older than 2 hours. But this does not solve the problem. Maybe NC Photo-App should look itself for "orphaned tmp-files" and delete them.

moltke69 avatar Jan 18 '24 17:01 moltke69