[UPDATED] InstantUpload working for one directory but not for another

UPDATE: it turns out I cut the logs short and there is one additonal line that includes a PROPFIND method that may be relevant.

Nextcloud version (eg, 20.0.5): 24.0.3
Operating system and version (eg, Ubuntu 20.04): Docker 20.10.17 on ArchLinux (nextcloud:stable image)
Apache or nginx version (eg, Apache 2.4.25): 2.4.54
PHP version (eg, 7.4): 8.0.21

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Uninstall Android dlient 3.20.3 (optionally clearing app data and clearing cache beforehand).
  2. Delete ~/InstantUpload/Screenshots and ~/InstantUpload/OpenCamera folders using the Nextcloud server web interface.
  3. Re-install Android client; authenticate, grant access and full access storage permissions.
  4. Settings > Auto upload > Select InstantUpload folders to synchronize, disable Battery Optimization.
  5. One directory (Screenshots) succeeds with a 207 response, the other (OpenCamera) fails with a 404 response from the server and “Connection error” reported by the client.

The output of your Nextcloud log in Admin > Logging:

  • Unobtainable (chosing “Download logs” results in being redirected to an Internal Servor Error page with Remote Address: 10.0.4.29, Request ID: 7H4Yyd1iaa7Xw4MWFPQG)
  • Nonexistent (the latest log message displayed before clicking the download link is dated 2022-03-29T15:48:15-0700).
    I’ve checked the file /var/www/html/data/nextcloud.log and it has a timestamp that agrees with this.

The output of your config.php file in /var/www/html/config (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'passwordsalt' => 'passwordsalt',
  'secret' => 'secret',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'example.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '24.0.3.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'proxy_proxysql',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'dbuser',
  'dbpassword' => 'dbpassword',
  'instanceid' => 'instanceid',
  'installed' => true,
  'theme' => '',
  'log_type' => 'syslog',
  'loglevel' => 0,
  'maintenance' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_from_address' => 'mail_from_address',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'example.com',
  'mail_smtphost' => 'mail_smtphost',
  'mail_smtpport' => '25',
  'ldapIgnoreNamingRules' => false,
  'encryption.legacy_format_support' => true,
  'encryption.key_storage_migrated' => false,
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => 'https://example.com',
);

The output of your Apache/nginx/system log in /var/log/____ captured by Docker:

10.0.4.29 - - [31/Jul/2022:15:04:18 -0700] "GET /index.php/204 HTTP/1.1" 204 1334 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - - [31/Jul/2022:15:04:19 -0700] "GET /index.php/204 HTTP/1.1" 204 1338 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:19 -0700] "HEAD /remote.php/dav/files/acc//InstantUpload/OpenCamera/IMG_20220730_111312.jpg HTTP/1.1" 404 509 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:19 -0700] "MKCOL /remote.php/dav/uploads/acc/d34db33f HTTP/1.1" 405 867 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:19 -0700] "PROPFIND /remote.php/dav/uploads/acc/d34db33f HTTP/1.1" 207 1848 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:26 -0700] "GET /index.php/avatar/acc/512 HTTP/1.1" 200 36465 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:26 -0700] "POST /ocs/v2.php/apps/notifications/api/v2/push?format=json HTTP/1.1"201 1772 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:26 -0700] "PROPFIND /remote.php/dav/files/acc//InstantUpload/ HTTP/1.1" 207 1866"-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:26 -0700] "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2FInstantUpload%2F&reshares=true&subfiles=true HTTP/1.1" 200 895 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:28 -0700] "GET /index.php/avatar/tlc/512 HTTP/1.1" 200 8127 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:29 -0700] "GET /status.php HTTP/1.1" 200 1016 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:29 -0700] "GET /ocs/v2.php/cloud/capabilities?format=json HTTP/1.1" 304 719 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:29 -0700] "GET /ocs/v2.php/cloud/user?format=json HTTP/1.1" 200 2009 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:29 -0700] "PROPFIND /remote.php/dav/files/acc// HTTP/1.1" 207 1854 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:29 -0700] "PROPFIND /remote.php/dav/files/acc// HTTP/1.1" 207 15245 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:30 -0700] "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2F&reshares=true&subfiles=true HTTP/1.1" 200 4335 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:31 -0700] "GET /ocs/v2.php/cloud/user?format=json HTTP/1.1" 200 2013 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:37 -0700] "HEAD /remote.php/dav/files/acc//InstantUpload/OpenCamera/IMG_20220730_111312.jpg HTTP/1.1" 404 509 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:37 -0700] "MKCOL /remote.php/dav/uploads/acc/d34db33f HTTP/1.1" 405 867 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
10.0.4.29 - acc [31/Jul/2022:15:04:38 -0700] "PROPFIND /remote.php/dav/uploads/acc/d34db33f HTTP/1.1" 207 1848 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"

The following is from haproxy 2.6.0, which sits in front of Nextcloud, also running in Docker:

<134>Jul 31 15:04:19 haproxy[8]: 192.168.0.137:48216 [31/Jul/2022:15:04:18.941] https-termination~ nextcloud/nextcloud-2 0/0/0/108/108 204 1269 - - --NI 17/10/2/0/0 0/0 "GET /index.php/204 HTTP/1.1"
<134>Jul 31 15:04:19 haproxy[8]: 192.168.0.137:48218 [31/Jul/2022:15:04:19.202] https-termination~ nextcloud/nextcloud-3 0/0/0/56/56 204 1275 - - --NI 18/11/2/1/0 0/0 "GET /index.php/204 HTTP/1.1"
<134>Jul 31 15:04:19 haproxy[8]: 192.168.0.137:48220 [31/Jul/2022:15:04:19.463] https-termination~ nextcloud/nextcloud-2 0/0/0/53/53 204 1273 - - --NI 19/12/2/0/0 0/0 "GET /index.php/204 HTTP/1.1"
<134>Jul 31 15:04:19 haproxy[8]: 192.168.0.137:40195 [31/Jul/2022:15:04:19.531] https-termination~ nextcloud/nextcloud-2 0/0/1/119/120 404 468 - - --VN 21/13/2/0/0 0/0 "HEAD /remote.php/dav/files/acc//InstantUpload/OpenCamera/IMG_20220730_111312.jpg HTTP/1.1"
<134>Jul 31 15:04:19 haproxy[8]: 192.168.0.137:40195 [31/Jul/2022:15:04:19.680] https-termination~ nextcloud/nextcloud-2 0/0/0/120/120 405 818 - - --VN 21/13/2/0/0 0/0 "MKCOL /remote.php/dav/uploads/acc/d34db33f HTTP/1.1"
<134>Jul 31 15:04:19 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:19.816] https-termination~ nextcloud/nextcloud-2 0/0/1/92/93 207 1787 - - --VN 22/14/2/0/0 0/0 "PROPFIND /remote.php/dav/uploads/acc/d34db33f HTTP/1.1"
<134>Jul 31 15:04:26 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:26.115] https-termination~ nextcloud/nextcloud-2 0/0/1/60/61 200 36396 - - --VN 29/19/4/2/0 0/0 "GET /index.php/avatar/acc/512 HTTP/1.1"
<134>Jul 31 15:04:26 haproxy[8]: 192.168.0.137:42289 [31/Jul/2022:15:04:26.122] https-termination~ nextcloud/nextcloud-2 0/0/1/76/77 201 1719 - - --VN 29/19/3/1/0 0/0 "POST /ocs/v2.php/apps/notifications/api/v2/push?format=json HTTP/1.1"
<134>Jul 31 15:04:26 haproxy[8]: 192.168.0.137:48254 [31/Jul/2022:15:04:26.111] https-termination~ nextcloud/nextcloud-3 0/0/0/156/156 200 1928 - - --NI 29/19/2/0/0 0/0 "GET /ocs/v2.php/cloud/user?format=json HTTP/1.1"
<134>Jul 31 15:04:26 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:26.668] https-termination~ nextcloud/nextcloud-2 0/0/0/91/91 207 1805 - - --VN 29/19/2/1/0 0/0 "PROPFIND /remote.php/dav/files/acc//InstantUpload/ HTTP/1.1"
<134>Jul 31 15:04:26 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:26.788] https-termination~ nextcloud/nextcloud-2 0/0/0/191/191 200 838 - - --VN 29/19/2/1/0 0/0 "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2FInstantUpload%2F&reshares=true&subfiles=true HTTP/1.1"
<134>Jul 31 15:04:28 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:28.509] https-termination~ nextcloud/nextcloud-2 0/0/0/67/67 200 8058 - - --VN 29/19/2/1/0 0/0 "GET /index.php/avatar/tlc/512 HTTP/1.1"
<134>Jul 31 15:04:29 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:29.056] https-termination~ nextcloud/nextcloud-2 0/0/0/32/32 200 967 - - --VN 27/18/2/1/0 0/0 "GET /status.php HTTP/1.1"
<134>Jul 31 15:04:29 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:29.118] https-termination~ nextcloud/nextcloud-2 0/0/0/61/61 304 670 - - --VN 27/18/2/1/0 0/0 "GET /ocs/v2.php/cloud/capabilities?format=json HTTP/1.1"
<134>Jul 31 15:04:29 haproxy[8]: 192.168.0.137:48264 [31/Jul/2022:15:04:29.221] https-termination~ nextcloud/nextcloud-1 0/0/0/156/156 200 1701 - - --NI 29/19/2/0/0 0/0 "GET /ocs/v2.php/apps/user_status/api/v1/predefined_statuses?format=json HTTP/1.1"
<134>Jul 31 15:04:29 haproxy[8]: 192.168.0.137:48266 [31/Jul/2022:15:04:29.426] https-termination~ nextcloud/nextcloud-2 0/0/1/189/190 200 1928 - - --NI 31/21/2/1/0 0/0 "GET /ocs/v2.php/cloud/user?format=json HTTP/1.1"
<134>Jul 31 15:04:29 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:29.632] https-termination~ nextcloud/nextcloud-2 0/0/0/145/145 207 1793 - - --VN 31/21/2/1/0 0/0 "PROPFIND /remote.php/dav/files/acc// HTTP/1.1"
<134>Jul 31 15:04:30 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:29.785] https-termination~ nextcloud/nextcloud-2 0/0/0/383/384 207 15172 - - --VN 31/21/2/0/0 0/0 "PROPFIND /remote.php/dav/files/acc// HTTP/1.1"
<134>Jul 31 15:04:30 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:30.319] https-termination~ nextcloud/nextcloud-2 0/0/0/226/226 200 4278 - - --VN 31/21/2/0/0 0/0 "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2F&reshares=true&subfiles=true HTTP/1.1"
<134>Jul 31 15:04:31 haproxy[8]: 192.168.0.137:48254 [31/Jul/2022:15:04:31.540] https-termination~ nextcloud/nextcloud-2 0/0/0/276/276 200 1932 - - --NI 31/21/2/0/0 0/0 "GET /ocs/v2.php/cloud/user?format=json HTTP/1.1"
<134>Jul 31 15:04:37 haproxy[8]: 192.168.0.137:48270 [31/Jul/2022:15:04:37.224] https-termination~ nextcloud/nextcloud-3 0/0/1/109/110 204 1273 - - --NI 32/22/2/0/0 0/0 "GET /index.php/204 HTTP/1.1"
<134>Jul 31 15:04:37 haproxy[8]: 192.168.0.137:48272 [31/Jul/2022:15:04:37.593] https-termination~ nextcloud/nextcloud-1 0/0/0/48/48 204 1269 - - --NI 33/23/2/1/0 0/0 "GET /index.php/204 HTTP/1.1"
<134>Jul 31 15:04:37 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:37.648] https-termination~ nextcloud/nextcloud-2 0/0/0/203/203 404 468 - - --VN 33/23/2/1/0 0/0 "HEAD /remote.php/dav/files/acc//InstantUpload/OpenCamera/IMG_20220730_111312.jpg HTTP/1.1"
<134>Jul 31 15:04:38 haproxy[8]: 192.168.0.137:43243 [31/Jul/2022:15:04:37.947] https-termination~ nextcloud/nextcloud-2 0/0/0/100/100 405 818 - - --VN 33/23/2/1/0 0/0 "MKCOL /remote.php/dav/uploads/acc/d34db33f HTTP/1.1"
<134>Jul 31 15:04:38 haproxy[8]: 192.168.0.137:42289 [31/Jul/2022:15:04:38.072] https-termination~ nextcloud/nextcloud-2 0/0/0/102/102 207 1787 - - --VN 33/23/2/1/0 0/0 "PROPFIND /remote.php/dav/uploads/acc/d34db33f HTTP/1.1"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

(Same situation as mentioned above, unobtainable and nonexistent.)

I have updated my haproxy configuration to use balance source and hash-type consistent rather than inserting a cookie into the backend request, as it seems that although the Nextcloud client 1. was storing those cookies at one time, 2. it no longer is, so that method of load balancing doesn’t work as expected. I don’t think it was interfering, but it was making chasing down logs a chore. And having requests proxied to one particular backend per session is ideal in this circumstance, I think.

[Can anyone confirm assertions numbered 1 and 2 above? I don’t have the time to hunt it down in the source right now.]

I’ve checked permissions (and ACLs), so that isn’t the cause of this.

However, I have a second Android installation which is now experiencing a similar problem: just one directory is failing to autoupload, others are uploading just fine.

Please also let me know if there’s any missing information that I can supply.

I am not sure how this happened, but the problem seems to have corrected itself.

Could this have been due to a database issue? I have had a number of Galera / MariaDB outages recently, where the storage device on one of my nodes has been remounted read-only.