Desktop client suddenly re-uploading thousands of files / Failed to connect to the database

Nextcloud version (eg, 20.0.5): 20.0.4.0
Operating system and version (eg, Ubuntu 20.04): Client: Mac OS Monterey 12.3.1. Server: Raspbian GNU/Linux 10. 5.10.103-v7+ (armv7l) (using latest NextCloudPi version v1.47.2)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38 (Raspbian)
PHP version (eg, 7.4): PHP 7.3.31-1~deb10u1

Suddenly the desktop client (using latest 3.50 Mac OS) starts to synchronize (upload) a large number of files, claiming they have been modified, even when the operating system doesn’t show anything like that.

The log says: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory

and then

RedisException: read error on connection

It still wants to upload files, and the “Activity” tab correctly shows that lots of files are being uploaded.

Can this be fixed, or do I need to re-install the server? I’m using Nextcloudpi.

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

The output of your Nextcloud log in Admin > Logging:

	App	Nachricht		Zeit
Error	core	RedisException: NOAUTH Authentication required.	
2022-05-18T16:25:29+0200
Error	core	RedisException: read error on connection	
2022-05-18T16:25:29+0200
Error	index	RedisException: read error on connection	
2022-05-18T16:25:28+0200
Fatal	no app in context	RedisException: read error on connection	
2022-05-18T16:25:28+0200
Error	cron	Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory	
2022-05-18T16:25:18+0200
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#691	
2022-05-18T16:13:11+0200
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#691	
2022-05-18T16:13:11+0200
Error	PHP	Error: Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#691	
2022-05-18T16:13:11+0200
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 256339100 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 228179968 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    5 => 'nextcloudpi.local',
    1 => '192.168.178.84',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
  ),
  'datadirectory' => '/media/SSD1/ncdata',
  'overwrite.cli.url' => 'http://localhost/',
  'dbtype' => 'mysql',
  'version' => '20.0.4.0',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'xxx=',
  'installed' => true,
  'instanceid' => 'xxx',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'xxx=',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'ncp_admin',
  'mail_domain' => 'xxx.myfritz.net',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'logfile' => '/media/SSD1/ncdata/nextcloud.log',
  'loglevel' => '2',
  'log_type' => 'file',
  'theme' => '',
  'mail_smtphost' => 'xxx.net',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpsecure' => 'tls',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => '######',
  'enable_previews' => false,
  'tempdirectory' => '/media/SSD1/ncdata/tmp',
  'jpeg_quality' => '60',
  'app_install_overwrite' => 
  array (
    0 => 'gallery',
  ),
  'data-fingerprint' => '41a9726d989aee4eae9c2b5e8cb6dacb',
);

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

/var/log/syslog: https://pastebin.com/A65Zbzu8

/var/log/redis//redis-server.log: https://pastebin.com/zTYtdW22

tail -f nextcloud.log

{"reqId":"YoUB1kN0K4AFArALfl38cAAAQwQ","level":3,"time":"2022-05-18T14:25:29+00:00","remoteAddr":"xxx.xxx.151.158","user":"--","app":"core","method":"PUT","url":"/index.php/apps/user_status/heartbeat","message":{"Exception":"RedisException","Message":"read error on connection","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/RedisFactory.php","line":94,"function":"auth","class":"Redis","type":"->","args":["18fm05c6iHD2CvLh8JMznUMMlwno8AYJNEnMQDaY3OA="]},{"file":"/var/www/nextcloud/lib/private/RedisFactory.php","line":108,"function":"create","class":"OC\\RedisFactory","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/Memcache/Redis.php","line":43,"function":"getInstance","class":"OC\\RedisFactory","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/Memcache/Factory.php","line":135,"function":"__construct","class":"OC\\Memcache\\Redis","type":"->","args":["89795be4cf849f373262ff9c519c945a/lock"]},{"file":"/var/www/nextcloud/lib/private/Server.php","line":1018,"function":"createLocking","class":"OC\\Memcache\\Factory","type":"->","args":["lock"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":155,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":122,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OCP\\Lock\\ILockingProvider"]},{"file":"/var/www/nextcloud/lib/private/ServerContainer.php","line":156,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCP\\Lock\\ILockingProvider",true]},{"file":"/var/www/nextcloud/lib/private/Server.php","line":1977,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OCP\\Lock\\ILockingProvider"]},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":118,"function":"getLockingProvider","class":"OC\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/Server.php","line":395,"function":"__construct","class":"OC\\Files\\View","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":155,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":122,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\Files\\Node\\HookConnector"]},{"file":"/var/www/nextcloud/lib/private/ServerContainer.php","line":156,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\Files\\Node\\HookConnector",true]},{"file":"/var/www/nextcloud/lib/private/Server.php","line":1324,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\Files\\Node\\HookConnector"]},{"file":"/var/www/nextcloud/lib/base.php","line":595,"function":"boot","class":"OC\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/RedisFactory.php","Line":94,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0","version":"20.0.4.0"}
{"reqId":"YoUB1kN0K4AFArALfl38cAAAQwQ","level":3,"time":"2022-05-18T14:25:29+00:00","remoteAddr":"xxx.xxx.151.158","user":"--","app":"core","method":"PUT","url":"/index.php/apps/user_status/heartbeat","message":{"Exception":"RedisException","Message":"NOAUTH Authentication required.","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Memcache/Redis.php","line":55,"function":"get","class":"Redis","type":"->","args":["89795be4cf849f373262ff9c519c945a/core.appinfo/var/www/nextcloud/apps/files/appinfo/info.xml1608065460"]},{"file":"/var/www/nextcloud/lib/private/App/InfoParser.php","line":58,"function":"get","class":"OC\\Memcache\\Redis","type":"->","args":["/var/www/nextcloud/apps/files/appinfo/info.xml1608065460"]},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":511,"function":"parse","class":"OC\\App\\InfoParser","type":"->","args":["/var/www/nextcloud/apps/files/appinfo/info.xml"]},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":526,"function":"getAppInfo","class":"OC\\App\\AppManager","type":"->","args":["files"]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":554,"function":"getAppVersion","class":"OC\\App\\AppManager","type":"->","args":["files",true]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":857,"function":"getAppVersion","class":"OC_App","type":"::","args":["files"]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1463,"function":"shouldUpgrade","class":"OC_App","type":"::","args":["files"]},{"file":"/var/www/nextcloud/lib/public/Util.php","line":516,"function":"needUpgrade","class":"OC_Util","type":"::","args":[{"__class__":"OC\\SystemConfig"}]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":117,"function":"needUpgrade","class":"OCP\\Util","type":"::","args":[]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":78,"function":"initTemplateEngine","class":"OC_Template","type":"::","args":["error"]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":322,"function":"__construct","class":"OC_Template","type":"->","args":["","exception","error",false]},{"file":"/var/www/nextcloud/index.php","line":63,"function":"printExceptionErrorPage","class":"OC_Template","type":"::","args":[{"__class__":"RedisException"},500]}],"File":"/var/www/nextcloud/lib/private/Memcache/Redis.php","Line":55,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0","version":"20.0.4.0"}