All files lose sharing after a period of time. (Clients Delete All Files)

Steps to reproduce

  1. This happens about every week on it’s own. Maybe from inactivity?

Expected behaviour

The sharing of the files should not change.

Actual behaviour

About every week, all the files on the server lose their sharing settings and get deleted from all clients. I have to login to the server and setup all the sharing setting again for each folder.

At first I setup a crontab to run this command every 15 minutes:

sudo docker exec owncloud occ user:list|sed -r 's/^.*- (\w+):.*$/\1/; /^CompanyUser$/ d'|while read user ; do echo occ files:transfer-ownership $user CompanyUser ; done

This command would use the user:list command to list all the users. Then the users are parsed out and iterated over and then the files:transfer-ownership command would be run on each user and transferred to the CompanyUser.

The purpose of this command was to ensure when a user is removed from the share. The files would not be deleted.

However, this bug started happening and I thought it might be the command that was causing it. I’ve been running the server for about a week now without the command running. It was removed from the crontab and the script was renamed so it was not possible to still be running. I also rebooted the OS.

Server configuration

Operating system:
Ubuntu Server 20.10

Web server:
Apache

Database:
SQLite

PHP version:
Default

ownCloud version:
10.6.0.5

Updated from an older ownCloud or fresh install:
Fresh install, pulled latest from docker. owncloud/server

Where did you install ownCloud from:
docker: owncloud/server

Signing status (ownCloud 9.0 and above):
No errors have been found.

The content of config/config.php:

List of activated apps:
Admin Config Report
Deleted files
Federation
Provisioning API
Share Files
Update notification
Versions
Activity
Collaborative tags
Comments
First run wizard
Mail Template Editor
Market
Media Viewer
Notifications
PDF Viewer
Text Editor

Are you using external storage, if yes which one: local/smb/sftp/…
No

Are you using encryption:
Should be.

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

Client configuration

Browser:
Google Chrome

Operating system:
Windows 10

Logs

Web server error log

Currently don’t have access.

ownCloud log (data/owncloud.log)

The log complains a lot about not being able to send emails.

This is the only different log that occurred around the time of the problem:

{"reqId":"gxn6xLs5rfzYNllPkzTk","level":3,"time":"2021-04-19T18:43:15+00:00","remoteAddr":"","user":"--","app":"core","method":"--","url":"--","message":"Error while running background job (class: OCA\\Files_Sharing\\ExpireSharesJob, arguments: ): {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\LockWaitTimeoutException\",\"Message\":\"An exception occurred while executing 'DELETE FROM \\\"oc_share\\\" WHERE (\\\"id\\\" = ?) OR (\\\"parent\\\" = ?)' with params [\\\"115\\\", \\\"115\\\"]:\\n\\nSQLSTATE[HY000]: General error: 5 database is locked\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(172): Doctrine\\\\DBAL\\\\Driver\\\\AbstractSQLiteDriver->convertException()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(151): Doctrine\\\\DBAL\\\\DBALException::wrapException()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1087): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(207): Doctrine\\\\DBAL\\\\Connection->executeUpdate()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Query\\\/QueryBuilder.php(210): OC\\\\DB\\\\Connection->executeUpdate()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/QueryBuilder\\\/QueryBuilder.php(141): Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder->execute()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Share20\\\/DefaultShareProvider.php(346): OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder->execute()\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Share20\\\/Manager.php(1138): OC\\\\Share20\\\\DefaultShareProvider->delete()\\n#8 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_sharing\\\/lib\\\/ExpireSharesJob.php(105): OC\\\\Share20\\\\Manager->deleteShare()\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/BackgroundJob\\\/Job.php(66): OCA\\\\Files_Sharing\\\\ExpireSharesJob->run()\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/BackgroundJob\\\/TimedJob.php(63): OC\\\\BackgroundJob\\\\Job->execute()\\n#11 \\\/var\\\/www\\\/owncloud\\\/core\\\/Command\\\/System\\\/Cron.php(125): OC\\\\BackgroundJob\\\\TimedJob->execute()\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Command\\\/Command.php(255): OC\\\\Core\\\\Command\\\\System\\\\Cron->execute()\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(1009): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run()\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(273): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand()\\n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(149): Symfony\\\\Component\\\\Console\\\\Application->doRun()\\n#16 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Console\\\/Application.php(165): Symfony\\\\Component\\\\Console\\\\Application->run()\\n#17 \\\/var\\\/www\\\/owncloud\\\/console.php(116): OC\\\\Console\\\\Application->run()\\n#18 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#19 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractSQLiteDriver.php\",\"Line\":26}"}
{"reqId":"gxn6xLs5rfzYNllPkzTk","level":3,"time":"2021-04-19T18:43:15+00:00","remoteAddr":"","user":"--","app":"core","method":"--","url":"--","message":"Caused by: {\"Exception\":\"Doctrine\\\\DBAL\\\\Driver\\\\PDOException\",\"Message\":\"SQLSTATE[HY000]: General error: 5 database is locked\",\"Code\":\"HY000\",\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1073): Doctrine\\\\DBAL\\\\Driver\\\\PDOStatement->execute()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(207): Doctrine\\\\DBAL\\\\Connection->executeUpdate()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Query\\\/QueryBuilder.php(210): OC\\\\DB\\\\Connection->executeUpdate()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/QueryBuilder\\\/QueryBuilder.php(141): Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder->execute()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Share20\\\/DefaultShareProvider.php(346): OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder->execute()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Share20\\\/Manager.php(1138): OC\\\\Share20\\\\DefaultShareProvider->delete()\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_sharing\\\/lib\\\/ExpireSharesJob.php(105): OC\\\\Share20\\\\Manager->deleteShare()\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/BackgroundJob\\\/Job.php(66): OCA\\\\Files_Sharing\\\\ExpireSharesJob->run()\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/BackgroundJob\\\/TimedJob.php(63): OC\\\\BackgroundJob\\\\Job->execute()\\n#9 \\\/var\\\/www\\\/owncloud\\\/core\\\/Command\\\/System\\\/Cron.php(125): OC\\\\BackgroundJob\\\\TimedJob->execute()\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Command\\\/Command.php(255): OC\\\\Core\\\\Command\\\\System\\\\Cron->execute()\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(1009): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run()\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(273): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand()\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(149): Symfony\\\\Component\\\\Console\\\\Application->doRun()\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Console\\\/Application.php(165): Symfony\\\\Component\\\\Console\\\\Application->run()\\n#15 \\\/var\\\/www\\\/owncloud\\\/console.php(116): OC\\\\Console\\\\Application->run()\\n#16 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#17 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/PDOStatement.php\",\"Line\":131}"}
{"reqId":"gxn6xLs5rfzYNllPkzTk","level":3,"time":"2021-04-19T18:43:15+00:00","remoteAddr":"","user":"--","app":"core","method":"--","url":"--","message":"Caused by: {\"Exception\":\"PDOException\",\"Message\":\"SQLSTATE[HY000]: General error: 5 database is locked\",\"Code\":\"HY000\",\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/PDOStatement.php(129): PDOStatement->execute()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1073): Doctrine\\\\DBAL\\\\Driver\\\\PDOStatement->execute()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/Connection.php(207): Doctrine\\\\DBAL\\\\Connection->executeUpdate()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Query\\\/QueryBuilder.php(210): OC\\\\DB\\\\Connection->executeUpdate()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/DB\\\/QueryBuilder\\\/QueryBuilder.php(141): Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder->execute()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Share20\\\/DefaultShareProvider.php(346): OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder->execute()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Share20\\\/Manager.php(1138): OC\\\\Share20\\\\DefaultShareProvider->delete()\\n#7 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_sharing\\\/lib\\\/ExpireSharesJob.php(105): OC\\\\Share20\\\\Manager->deleteShare()\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/BackgroundJob\\\/Job.php(66): OCA\\\\Files_Sharing\\\\ExpireSharesJob->run()\\n#9 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/BackgroundJob\\\/TimedJob.php(63): OC\\\\BackgroundJob\\\\Job->execute()\\n#10 \\\/var\\\/www\\\/owncloud\\\/core\\\/Command\\\/System\\\/Cron.php(125): OC\\\\BackgroundJob\\\\TimedJob->execute()\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Command\\\/Command.php(255): OC\\\\Core\\\\Command\\\\System\\\\Cron->execute()\\n#12 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(1009): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run()\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(273): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand()\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/symfony\\\/console\\\/Application.php(149): Symfony\\\\Component\\\\Console\\\\Application->doRun()\\n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Console\\\/Application.php(165): Symfony\\\\Component\\\\Console\\\\Application->run()\\n#16 \\\/var\\\/www\\\/owncloud\\\/console.php(116): OC\\\\Console\\\\Application->run()\\n#17 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#18 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/PDOStatement.php\",\"Line\":129}"}

Browser log

Not relevant.

In your config report I can see you have set

"shareapi_default_expire_date_user_share": "yes",
"shareapi_expire_after_n_days_user_share": "7",

In the setting for sharing, you can set “default expiration date for user shares” and it seems you had set it to 7 days.

Please check this too for group shares and remote shares

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.