Skip to content

File is lock in Nextcloud 11 with Redis filelocking turned on #2813

Closed

Description

@KKyang

Steps to reproduce

  1. Upload a folder with 13GB of files
  2. Nextcloud accidentally crashed
  3. Restart Nextcloud server

Expected behaviour

Able to re-upload files

Actual behaviour

File is locked by Redis

Note: FAQ in the Nextcloud forum does not work. File still locked after deleting the table.

Server configuration

Operating system: Ubuntu 14.04 (kernel 4.4.0-34)

Web server: Apache 2

Database: MySQL

PHP version: 7.0

Nextcloud version: 11

Updated from an older Nextcloud/ownCloud or fresh install: Updated from the latest version of Nextcloud 10

Where did you install Nextcloud from: Nextcloud website

Signing status:

Signing status
Integrity checker has been disabled. Integrity cannot be verified.
Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

App list
Collabora Online
Anouncement Center

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

The content of config/config.php:

Config report
<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'trusted_domains' => 
  array (
    0 => '',
  ),
  'datadirectory' => '',
  'dbtype' => 'mysql',
  'version' => '9.1.2.2',
  'dbname' => '',
  'dbhost' => '127.0.0.1',
  'dbtableprefix' => '',
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'forcessl' => true,
  'loglevel' => 0,
  'maxZipInputSize' => 1073741824,
  'allowZipDownload' => true,
  'theme' => '',
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpsecure' => 'ssl',
  'mail_smtptimeout' => 30,
  'mail_smtpauth' => true,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'overwritewebroot' => '',
  'mail_smtpport' => '465',
  'secret' => 
  'forceSSLforSubdomains' => true,
  'trashbin_retention_obligation' => 'auto',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'updatechecker' => true,
  'updater.release.channel' => 'production',
  'appstoreenabled' => true,
  'appstore.experimental.enabled' => true,
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
  ),
  'updater.secret' => ,
);

Are you using external storage, if yes which one: No

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

Client configuration

Browser: Firefox 50.1.0

Operating system: Windows 10

Logs

Web server error log

Web server error log ``` Insert your webserver log here ```

Nextcloud log (data/nextcloud.log)

Nextcloud log
Exception while scanning: "files/789fce897dc6d415e3e99090cd979c4e" is locked
#0 /var/www/nextcloud/lib/private/Files/Storage/Common.php(680): OC\Lock\MemcacheLockingProvider->acquireLock('files/789fce897...', 2)
#1 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(588): OC\Files\Storage\Common->acquireLock('files/lab resou...', 2, Object(OC\Lock\MemcacheLockingProvider))
#2 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(588): OC\Files\Storage\Wrapper\Wrapper->acquireLock('files/lab resou...', 2, Object(OC\Lock\MemcacheLockingProvider))
#3 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(588): OC\Files\Storage\Wrapper\Wrapper->acquireLock('files/lab resou...', 2, Object(OC\Lock\MemcacheLockingProvider))
#4 /var/www/nextcloud/apps/files_sharing/lib/SharedStorage.php(395): OC\Files\Storage\Wrapper\Wrapper->acquireLock('files/lab resou...', 2, Object(OC\Lock\MemcacheLockingProvider))
#5 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(588): OCA\Files_Sharing\SharedStorage->acquireLock('scanner::', 2, Object(OC\Lock\MemcacheLockingProvider))
#6 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(316): OC\Files\Storage\Wrapper\Wrapper->acquireLock('scanner::', 2, Object(OC\Lock\MemcacheLockingProvider))
#7 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(196): OC\Files\Cache\Scanner->scan('', true, 3)
#8 /var/www/nextcloud/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/R05631013')
#9 /var/www/nextcloud/apps/files/lib/Command/Scan.php(227): OCA\Files\Command\Scan->scanFiles('R05631013', '/R05631013', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#10 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(256): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/nextcloud/3rdparty/symfony/console/Application.php(818): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/nextcloud/3rdparty/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/nextcloud/3rdparty/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/nextcloud/lib/private/Console/Application.php(169): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/nextcloud/console.php(90): OC\Console\Application->run()
#17 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#18 {main}

Browser log

Browser log ``` Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

</details>

Activity

  1. KKyang commented on Dec 22, 2016

    @KKyang
    Author

    Use

    sudo redis-cli flushall
    

    does not help either.

    It gave me this

    Exception while scanning: File entry could not be inserted with insertIfNotExist() but could also not be selected with getId() in order to perform an update. Please try again.
    #0 /var/www/nextcloud/lib/private/Files/Cache/Cache.php(232): OC\Files\Cache\Cache->insert('files/lab resou...', Array)
    #1 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(277): OC\Files\Cache\Cache->put('files/lab resou...', Array)
    #2 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(217): OC\Files\Cache\Scanner->addToCache('files/lab resou...', Array, -1)
    #3 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(420): OC\Files\Cache\Scanner->scanFile('files/lab resou...', 3, '624985', false, true)
    #4 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren('files/lab resou...', true, 3, '624985', true, 0)
    #5 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files/lab resou...', true, 3, '624985', true)
    #6 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files/lab resou...', true, 3, '387', true)
    #7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files/lab resou...', true, 3, '55247', true)
    #8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files/lab resou...', true, 3, '15', true)
    #9 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files', true, 3, '2', true)
    #10 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(322): OC\Files\Cache\Scanner->scanChildren('', true, 3, '1', true)
    #11 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(196): OC\Files\Cache\Scanner->scan('', true, 3)
    #12 /var/www/nextcloud/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/BBLabAdmin')
    #13 /var/www/nextcloud/apps/files/lib/Command/Scan.php(227): OCA\Files\Command\Scan->scanFiles('BBLabAdmin', '/BBLabAdmin', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
    #14 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(256): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #15 /var/www/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(818): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #18 /var/www/nextcloud/3rdparty/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #19 /var/www/nextcloud/lib/private/Console/Application.php(169): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #20 /var/www/nextcloud/console.php(90): OC\Console\Application->run()
    #21 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
    #22 {main}
    
  2. KKyang commented on Dec 22, 2016

    @KKyang
    Author

    Problem solved by

    1. Put the server in maintenance mode.
    2. Removing all the uploaded data directly from terminal
    3. Flush the Redis server cache
    4. Turn off maintenance mode
    5. Rescan all files
    6. Re-upload all the files with terminal
    7. Rescan all files
  3. nickvergessen commented on Jan 18, 2017

    @nickvergessen
    Member

    About the error:

    File entry could not be inserted with insertIfNotExist

    https://docs.nextcloud.com/server/11/admin_manual/configuration_database/linux_database_configuration.html#database-read-commited-transaction-isolation-level

    Other then that, glad to here you found a way to continue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions