Steps to reproduce
- Get permission to use Nextcloud's DocumentsProvider via
OPEN_DOCUMENT_TREE
- Create a new file and gets its
Uri
- Write bytes to
context.contentResolver.openOutputStream(uri) and close the stream
- Create a second file and get its
Uri
- Write bytes to
context.contentResolver.openOutputStream(uri2) and close the stream
- Observe one of these files having 0 bytes and no corresponding Upload log in the app's Uploads screen
Expected behaviour
All files should get successfully uploaded or an error thrown or at least logged.
Actual behaviour
In almost all runs of the reproduction steps above, one of the files is not uploaded, but no errors was thrown/logged.
I have not yet tried this, but can do so if someone things this matters.
Environment data
Android version: 10
Nextcloud app version: 3.12.1 and master
Nextcloud server version: 18.0.7
Reverse proxy: no
Logs
Web server error log
Can provide them when needed.
Nextcloud log (data/nextcloud.log)
2020-08-17 16:54:35.793 D/DocumentsStorageProvider: isChildDocument(), parent=861986647/5, id=861986647/13
2020-08-17 16:54:35.798 D/DocumentsStorageProvider: queryDocument(), id=861986647/13
2020-08-17 16:54:35.804 D/DocumentsStorageProvider: isChildDocument(), parent=861986647/5, id=861986647/13
2020-08-17 16:54:35.808 D/DocumentsStorageProvider: queryDocument(), id=861986647/13
2020-08-17 16:54:35.940 D/DocumentsStorageProvider: isChildDocument(), parent=861986647/5, id=861986647/13
2020-08-17 16:54:35.950 D/DocumentsStorageProvider: openDocument(), id=861986647/13
2020-08-17 16:54:35.961 D/FileDownloader: Starting command with id 6
2020-08-17 16:54:35.968 D/FileDownloader: Account [redacted] exists
2020-08-17 16:54:35.985 D/OwnCloudClient #0: REQUEST GET /remote.php/webdav/.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM%3Dp9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp%3DREauYt5wE_HV5GzADASe%3DatpCzOhC7BtXj2qR%2BYU1whuO6oYzJXEF%2B2FoOSq%2BxQdognJmb_1K9Riy6X
2020-08-17 16:54:36.702 I/DownloadFileRemoteOperation: Download of /.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM=p9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp=REauYt5wE_HV5GzADASe=atpCzOhC7BtXj2qR+YU1whuO6oYzJXEF+2FoOSq+xQdognJmb_1K9Riy6X to /storage/emulated/0/Android/media/com.nextcloud.android.beta/nextcloud/tmp/[redacted]/.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM=p9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp=REauYt5wE_HV5GzADASe=atpCzOhC7BtXj2qR+YU1whuO6oYzJXEF+2FoOSq+xQdognJmb_1K9Riy6X: Operation finished with HTTP status code 200 (success)
2020-08-17 16:54:36.702 D/DownloadFileOperation: Unable to create parent folder /storage/emulated/0/Android/media/com.nextcloud.android.beta/nextcloud/[redacted]/.SeedVaultAndroidBackup
2020-08-17 16:54:36.703 I/DownloadFileOperation: Download of /.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM=p9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp=REauYt5wE_HV5GzADASe=atpCzOhC7BtXj2qR+YU1whuO6oYzJXEF+2FoOSq+xQdognJmb_1K9Riy6X to /storage/emulated/0/Android/media/com.nextcloud.android.beta/nextcloud/[redacted]/.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM=p9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp=REauYt5wE_HV5GzADASe=atpCzOhC7BtXj2qR+YU1whuO6oYzJXEF+2FoOSq+xQdognJmb_1K9Riy6X: Operation finished with HTTP status code 200 (success)
2020-08-17 16:54:36.743 D/FileDataStorageManager: Number of files updated with CONFLICT: 1
2020-08-17 16:54:36.743 D/FileDataStorageManager: checking parents to remove conflict; STARTING with /.SeedVaultAndroidBackup/
2020-08-17 16:54:36.745 D/FileDataStorageManager: NO MORE conflicts in /.SeedVaultAndroidBackup/
2020-08-17 16:54:36.753 D/FileDataStorageManager: checking parents to remove conflict; NEXT /
2020-08-17 16:54:36.758 D/FileDataStorageManager: NO MORE conflicts in /
2020-08-17 16:54:36.770 D/FileDataStorageManager: checking parents to remove conflict; NEXT
2020-08-17 16:54:36.778 D/FileDownloader: Stopping after command with id 6
2020-08-17 16:54:37.006 D/DocumentsStorageProvider: isChildDocument(), parent=861986647/5, id=861986647/13
2020-08-17 16:54:37.012 D/FileDataStorageManager: Number of files updated with CONFLICT: 1
2020-08-17 16:54:37.012 D/FileDataStorageManager: checking parents to remove conflict; STARTING with /.SeedVaultAndroidBackup/
2020-08-17 16:54:37.015 D/FileDataStorageManager: NO MORE conflicts in /.SeedVaultAndroidBackup/
2020-08-17 16:54:37.021 D/FileDataStorageManager: checking parents to remove conflict; NEXT /
2020-08-17 16:54:37.024 D/DocumentsStorageProvider: isChildDocument(), parent=861986647/5, id=861986647/13
2020-08-17 16:54:37.026 D/FileDataStorageManager: NO MORE conflicts in /
2020-08-17 16:54:37.034 D/FileDataStorageManager: checking parents to remove conflict; NEXT
2020-08-17 16:54:37.034 I/SynchronizeFileOperation: Synchronizing [redacted], file /.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM=p9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp=REauYt5wE_HV5GzADASe=atpCzOhC7BtXj2qR+YU1whuO6oYzJXEF+2FoOSq+xQdognJmb_1K9Riy6X: Operation finished with HTTP status code -1 (success)
2020-08-17 16:54:37.037 D/DocumentsStorageProvider: openDocument(), id=861986647/13
2020-08-17 16:54:37.050 D/OwnCloudClient #0: REQUEST PROPFIND /remote.php/webdav/.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM%3Dp9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp%3DREauYt5wE_HV5GzADASe%3DatpCzOhC7BtXj2qR%2BYU1whuO6oYzJXEF%2B2FoOSq%2BxQdognJmb_1K9Riy6X
2020-08-17 16:54:37.396 D/FileDataStorageManager: Number of files updated with CONFLICT: 1
2020-08-17 16:54:37.397 D/FileDataStorageManager: checking parents to remove conflict; STARTING with /.SeedVaultAndroidBackup/
2020-08-17 16:54:37.401 D/FileDataStorageManager: NO MORE conflicts in /.SeedVaultAndroidBackup/
2020-08-17 16:54:37.412 D/FileDataStorageManager: checking parents to remove conflict; NEXT /
2020-08-17 16:54:37.416 D/FileDataStorageManager: NO MORE conflicts in /
2020-08-17 16:54:37.427 D/FileDataStorageManager: checking parents to remove conflict; NEXT
2020-08-17 16:54:37.427 I/SynchronizeFileOperation: Synchronizing [redacted], file /.SeedVaultAndroidBackup/3BpkMhCD2Jo6RyF9ciRkATB8pLIi_R3qE0WRdOBl6LM=p9Z2iQsFlkLctqJV1QNDS3DVx5scCzhLG_gXN27I_n6f3sMUfnbKHjaN3nyDpuwcLHhiZhAfWAp=REauYt5wE_HV5GzADASe=atpCzOhC7BtXj2qR+YU1whuO6oYzJXEF+2FoOSq+xQdognJmb_1K9Riy6X: Operation finished with HTTP status code -1 (success)
Observe the status code of -1 which doesn't exist and hints at an unnoticed problem. Also, it seems that files are uploaded asynchronously. Not sure if this is the expected behavior or if a consumer of the DocumentsProvider needs to observe the Uri for changes to find out when a write was complete.
I will dig into this more later and update the issue.
Steps to reproduce
OPEN_DOCUMENT_TREEUricontext.contentResolver.openOutputStream(uri)and close the streamUricontext.contentResolver.openOutputStream(uri2)and close the streamExpected behaviour
All files should get successfully uploaded or an error thrown or at least logged.
Actual behaviour
In almost all runs of the reproduction steps above, one of the files is not uploaded, but no errors was thrown/logged.
Can you reproduce this problem on https://try.nextcloud.com?
I have not yet tried this, but can do so if someone things this matters.
Environment data
Android version: 10
Nextcloud app version: 3.12.1 and master
Nextcloud server version: 18.0.7
Reverse proxy: no
Logs
Web server error log
Can provide them when needed.
Nextcloud log (data/nextcloud.log)
Observe the status code of
-1which doesn't exist and hints at an unnoticed problem. Also, it seems that files are uploaded asynchronously. Not sure if this is the expected behavior or if a consumer of the DocumentsProvider needs to observe the Uri for changes to find out when a write was complete.I will dig into this more later and update the issue.