Server replied "500 Internal Server Error" to " PUT URL/to/file.jpg

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

Hi,
I’m trying to synchronize a bunch of files from my localhost to my self hosted nextcloud instance. Some files uploaded just fine but for others, I get the “Internal Server Error” in my nextcloud sync client and I’m wondering why this is.

Nextcloud version (eg, 12.0.2):
Operating system and version (eg, Ubuntu 17.04): Server: Raspbian GNU/Linux 10 (buster), Client: Arch
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38
PHP version (eg, 7.1): PHP Version 7.3.11-1

The issue you are facing:
Internal Se=rver Error

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

Steps to replicate it:

  1. upload files through nextcloud sync client

The output of your Nextcloud log in Admin > Logging:



[webdav] Fatal: Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE "oc_file_locks" SET "lock" = -1, "ttl" = ? WHERE "key" = ? AND "lock" = 1' with params [1581957899, "files\/e52e8c02496d5b18c4ec8c82345bd81f"]:

SQLSTATE[HY000]: General error: 5 database is locked at <<closure>>

 0. /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 169
    Doctrine\DBAL\Driver\AbstractSQLiteDriver->convertException("An exception oc ... d", Doctrine\DBAL\Dr ... ]})
 1. /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 145
    Doctrine\DBAL\DBALException::wrapException(Doctrine\DBAL\Driver\PDOSqlite\Driver {}, Doctrine\DBAL\Dr ... ]}, "An exception oc ... d")
 2. /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 1063
    Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Doctrine\DBAL\Driver\PDOSqlite\Driver {}, Doctrine\DBAL\Dr ... ]}, "UPDATE \"oc_fil ... 1", {1: 1581957899,2 ... "})
 3. /var/www/html/nextcloud/lib/private/DB/Connection.php line 216
    Doctrine\DBAL\Connection->executeUpdate("UPDATE \"oc_fil ... 1", [1581957899,"fil ... "], [])
 4. /var/www/html/nextcloud/lib/private/Lock/DBLockingProvider.php line 260
    OC\DB\Connection->executeUpdate("UPDATE \"oc_fil ... 1", [1581957899,"fil ... "])
 5. /var/www/html/nextcloud/lib/private/Files/Storage/Common.php line 807
    OC\Lock\DBLockingProvider->changeLock("files/e52e8c02496d5b18c4ec8c82345bd81f", 2)
 6. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 615
    OC\Files\Storage\Common->changeLock("GDrive/Google Photos/2010/10/1396.JPG", 2, OC\Lock\DBLockingProvider {})
 7. /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 615
    OC\Files\Storage\Wrapper\Wrapper->changeLock("GDrive/Google Photos/2010/10/1396.JPG", 2, OC\Lock\DBLockingProvider {})
 8. /var/www/html/nextcloud/lib/private/Files/View.php line 1981
    OC\Files\Storage\Wrapper\Wrapper->changeLock("GDrive/Google Photos/2010/10/1396.JPG", 2, OC\Lock\DBLockingProvider {})
 9. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Node.php line 392
    OC\Files\View->changeLock("/USB/GDrive/Goo ... G", 2)
10. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 253
    OCA\DAV\Connector\Sabre\Node->changeLock(2)
11. /var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156
    OCA\DAV\Connector\Sabre\File->put(null)
12. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    OCA\DAV\Connector\Sabre\Directory->createFile("1396.JPG", null)
13. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    Sabre\DAV\Server->createFile("files/stdcerr/U ... G", null, null)
14. <<closure>>
    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
15. /var/www/html/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
16. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:PUT", [Sabre\HTTP\Requ ... }])
17. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
18. /var/www/html/nextcloud/apps/dav/lib/Server.php line 317
    Sabre\DAV\Server->exec()
19. /var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
20. /var/www/html/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/var/www/html/n ... p")

PUT /nextcloud/remote.php/dav/files/stdcerr/USB/GDrive/Google%20Photos/2010/10/1396.JPG
from 192.168.1.1 by stdcerr at 2020-02-17T15:45:59+00:00

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

<?php
$CONFIG = array (
  'instanceid' => 'ocqh8k0dgbes',
  'passwordsalt' => 'example',
  'secret' => 'example',
  'trusted_domains' => 
  array (
    0 => 'raspi',
    1 => '192.168.1.198',
    2 => 'example.duckdns.org',
  ),
  'datadirectory' => '/var/nextcloud/data',
  'dbtype' => 'sqlite3',
  'version' => '17.0.3.1',
  'overwrite.cli.url' => 'http://raspi/nextcloud',
  'installed' => true,
  'maintenance' => false,
  'updater.secret' => 'example',
  'theme' => '',
  'loglevel' => 0,
  'mail_from_address' => 'example',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'example.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.example.com',
  'mail_smtpport' => '465',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => 'example@example.com',
  'mail_smtppassword' => 'example',
  'onlyoffice' => 
  array (
    'verify_peer_off' => true,
  ),
);

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

Loads of errors in access.log like:

192.168.1.1 - stdcerr [17/Feb/2020:15:58:44 +0000] "PUT /nextcloud/remote.php/dav/files/stdcerr/USB/GDrive/Google%20Photos/2010/10/1570.JPG HTTP/1.1" 500 1032 "-" "Mozilla/5.0 (Linux) mirall/2.6.2git (Nextcloud)"
or:
192.168.1.1 - - [17/Feb/2020:16:00:47 +0000] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 1430 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0"

It seems like a reboot of the server node resolved the issue… :upside_down_face: