Skip to content

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Aug 11, 2025

  • Tests written, or not not needed

Fixes

#14945 (comment)

10:54:53.066  D  cache_test_DISK_         image read from disk 389741429
10:54:53.067  D  AutoRename               Before - /bbaR/TEST_21 (2).jpg
10:54:53.068  D  AutoRename               After - /bbaR/TEST_21 (2).jpg
10:54:53.068  V  UploadsStorageManager    Updating .../TEST_21 (2).jpg with status:UPLOAD_SUCCEEDED, result:FILE_NOT_FOUND
10:54:53.068  V  UploadsStorageManager    Updating .../TEST_21 (2).jpg with status=UPLOAD_SUCCEEDED
10:54:53.071  D  UploadsStorageManager    updateUpload returns 1 for file: .../TEST_21 (2).jpg
10:54:53.071  D  UploadsStorageManager    notifyObserversNow
10:54:53.071  D  FileUploadWorker         NotifyUploadResult: LOCAL_FILE_NOT_FOUND
10:54:53.073  W  UploadFileOperation      file is null, obtaining from upload

Issue

When uploading large batches of files (≈50 or more), UploadFileOperation is invoked multiple times for the same file. This can cause race conditions where one thread deletes or releases a file reference before another thread attempts to read it, resulting in a LOCAL_FILE_NOT_FOUND error.

How to reproduce?

  1. Have a local folder that contains 50 images
  2. Setup AutoUpload for that local folder with "move to app folder"
  3. Check logs

Copy link

Codacy

Lint

TypemasterPR
Warnings4849
Errors1111

SpotBugs

CategoryBaseNew
Bad practice6060
Correctness6365
Dodgy code296296
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3535
Performance5050
Security1818
Total532534

Lint increased!

SpotBugs increased!

Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/15333.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@alperozturk96
Copy link
Collaborator Author

For 50 files, 70 UploadFileOperation used.

Screenshot 2025-08-11 at 16 30 26

@alperozturk96
Copy link
Collaborator Author

When I try to catch all errors in move function via same scenario, function didn't throw any error.

Also, even spotbugs warns about multithread correctness @tobiasKaminsky

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant