Skip to content

[Bug]: Database deadlock seems to cause files ownership issues #52549

Open
@cmigliorini

Description

@cmigliorini

⚠️ This issue respects the following points: ⚠️

Bug description

After my self-hosted Nextcloud instance was upgraded to 31.0.6, I decided to move many folders at once, through the frontend

  • from a drive that I had shared (r/w) with user B
  • that contained files belonging to user B
  • to a Teams Folder shared with B (through a common user group)

Context:

  • there is a Teams Folder (Y_Commun belonging to group family)
  • there is a Photos folder in the root of Y_Commun
  • I'm moving folders from my personal folders to Photos
  • said folders contain mostly files belonging to me, and some files belonging to B

In several occasions,

  1. some random files in some folders became inaccessible to me although they were shown in the Teams Folder; only their content was inaccessible, causing 404 errors in the frontend console. They were shown as "owned by B" in Y_Commun\Photos\some_folder, where all others where shown as "Shared"
  2. more recently, after a second batch of moving folders to the Teams Folder, Photos became invisible, although if I changed the URL in my browser I could still see its content.
  3. worse, now whenever I create a Y_Commun\another_folder, it is shown only until I refresh the page, and is not shown from other tabs anyway

There is one common observation to the above: this seems to come only after an error popup indicates that something went wrong; and the error is clearly a database issue

Below a screenshot I managed to get
Image

and a typical error I grabbed from nextcloud.log
SQL-error.json

Steps to reproduce

  1. Admin creates a Teams Folder Y_Commun -- not sure this is necessary but I don't really want to screw all of my instance so I did not try
  2. user A share a personal folder P with user B, populate it with several other folders F1, F2, ... Fn, each containing files
  3. user B uploads files to F1, F2, ... Fn
  4. user A creates a new folder Y_Commun/Photos in Teams Folder
  5. user A selects a subset of F1, F2, ... Fn (several, not only one) from P, clicks on "Move or Copy", then selects Y_Commun/Photos as destination

Then the following can happen:

  1. some of the files in Y_Commun/Photos/F1, ..., originally uploaded by B, are visible to A but their content is only available to B. In this case, a workaround is for B to move files away to another, personal folder, then move them back to Y_Commun/Photos/F1, ...
  2. eventually, Y_Commun
  • is not visible anymore in "Teams Folders" for both A and B
  • is listed in "All Files" view for both A and B
  1. and Y_Commun/Photos
  • is invisible to both A and B
  • but its content ( F1, F2, ... Fn) can be viewed by changing the URL in the browser's navigation bar

Expected behavior

  • all files should be shared
  • Y_Commun should be visible to both A and B
  • Photos should be visible in Y_Commun

Nextcloud Server version

31

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 31 to 32)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "example.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "31.0.4.1",
        "overwrite.cli.url": "https:\/\/example.com",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "default_phone_region": "FR",
        "maintenance": false,
        "maintenance_window_start": 1,
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "sendmail",
        "mail_sendmailmode": "pipe",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\Krita",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\Movie",
            "OC\\Preview\\PDF",
            "OC\\Preview\\Photoshop",
            "OC\\Preview\\Postscript",
            "OC\\Preview\\StarOffice",
            "OC\\Preview\\SVG",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\Font",
            "OC\\Preview\\Image"
        ],
        "preview_max_filesize_image": -1,
        "filesystem_check_changes": 1,
        "theme": "",
        "loglevel": 1,
        "log_rotate_size": 0,
        "memories.exiftool": "\/data\/homes\/example.com\/nextcloud\/apps\/memories\/bin-ext\/exiftool-amd64-glibc",
        "memories.ffmpeg_path": "\/usr\/bin\/ffmpeg",
        "memories.ffprobe_path": "\/usr\/bin\/ffprobe",
        "memories.no_transcode": false,
        "memories.transcoder": "\/data\/homes\/example.com\/nextcloud\/apps\/memories\/exiftool-bin\/go-vod-amd64",
        "memories.qsv": false,
        "memories.vod.path": "\/data\/homes\/example.com\/nextcloud\/apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "preview_max_memory": 1024,
        "memories.vod.disable": false,
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "memories.gis_type": 2,
        "memories.db.triggers.fcu": true,
        "trashbin_retention_obligation": "auto, 180",
        "app_install_overwrite": [
            "files_fulltextsearch_tesseract"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 4.0.0
  - admin_audit: 1.21.0
  - app_api: 5.0.2
  - bruteforcesettings: 4.0.0
  - calendar: 5.2.2
  - camerarawpreviews: 0.8.7
  - circles: 31.0.0
  - cloud_federation_api: 1.14.0
  - cloud_py_api: 0.2.0
  - comments: 1.21.0
  - contacts: 7.0.6
  - contactsinteraction: 1.12.0
  - dashboard: 7.11.0
  - dav: 1.33.0
  - deck: 1.15.0
  - federatedfilesharing: 1.21.0
  - federation: 1.21.0
  - files: 2.3.1
  - files_downloadlimit: 4.0.0
  - files_fulltextsearch: 31.0.0
  - files_fulltextsearch_tesseract: 27.0.1
  - files_pdfviewer: 4.0.0
  - files_reminders: 1.4.0
  - files_sharing: 1.23.1
  - files_trashbin: 1.21.0
  - files_versions: 1.24.0
  - firstrunwizard: 4.0.0
  - fulltextsearch: 31.0.0
  - fulltextsearch_elasticsearch: 31.0.0
  - groupfolders: 19.0.4
  - logreader: 4.0.0
  - lookup_server_connector: 1.19.0
  - memories: 7.5.2
  - nextcloud_announcements: 3.0.0
  - notifications: 4.0.0
  - oauth2: 1.19.1
  - password_policy: 3.0.0
  - photos: 4.0.0-dev.1
  - previewgenerator: 5.8.0
  - privacy: 3.0.0
  - profile: 1.0.0
  - provisioning_api: 1.21.0
  - recognize: 9.0.1
  - recommendations: 4.0.0
  - related_resources: 2.0.0
  - richdocuments: 8.6.4
  - richdocumentscode: 24.4.1303
  - serverinfo: 3.0.0
  - settings: 1.14.0
  - sharebymail: 1.21.0
  - spreed: 21.0.3
  - support: 3.0.0
  - survey_client: 3.0.0
  - suspicious_login: 9.0.1
  - systemtags: 1.21.1
  - tasks: 0.16.1
  - text: 5.0.0
  - theming: 2.6.1
  - thesearchpage: 1.2.10
  - timemanager: 0.3.18
  - twofactor_backupcodes: 1.20.0
  - twofactor_totp: 13.0.0-dev.0
  - updatenotification: 1.21.0
  - user_status: 1.11.0
  - viewer: 4.0.0
  - weather_status: 1.11.0
  - webhook_listeners: 1.2.0
  - workflowengine: 2.13.0
Disabled:
  - encryption: 2.19.0
  - files_external: 1.23.0
  - maps: 1.5.0 (installed 1.5.0)
  - twofactor_nextcloud_notification: 5.0.0
  - user_ldap: 1.22.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{
    "reqId": "Bta7UPElWz867Cvsa8bn",
    "level": 3,
    "time": "2025-04-29T06:39:56+00:00",
    "remoteAddr": "86.245.190.16",
    "user": "user",
    "app": "webdav",
    "method": "MOVE",
    "url": "/remote.php/dav/files/user/path/folder_name",
    "message": "An exception occurred while executing a query: SQLSTATE[40P01]: Deadlock detected: 7 ERROR:  deadlock detected\nDETAIL:  Process 227349 waits for ShareLock on transaction 76628760; blocked by process 227362.\nProcess 227362 waits for ShareLock on transaction 76628753; blocked by process 227349.\nHINT:  See server log for query details.\nCONTEXT:  while updating tuple (79273,3) in relation \"oc_filecache\"",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0",
    "version": "31.0.4.1",
    "exception": {
        "Exception": "OC\\DB\\Exceptions\\DbalException",
        "Message": "An exception occurred while executing a query: SQLSTATE[40P01]: Deadlock detected: 7 ERROR:  deadlock detected\nDETAIL:  Process 227349 waits for ShareLock on transaction 76628760; blocked by process 227362.\nProcess 227362 waits for ShareLock on transaction 76628753; blocked by process 227349.\nHINT:  See server log for query details.\nCONTEXT:  while updating tuple (79273,3) in relation \"oc_filecache\"",
        "Code": 7,
        "Trace": [
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/DB/ConnectionAdapter.php",
                "line": 69,
                "function": "wrap",
                "class": "OC\\DB\\Exceptions\\DbalException",
                "type": "::"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
                "line": 306,
                "function": "executeStatement",
                "class": "OC\\DB\\ConnectionAdapter",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php",
                "line": 289,
                "function": "executeStatement",
                "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Cache.php",
                "line": 773,
                "function": "executeStatement",
                "class": "OC\\DB\\QueryBuilder\\ExtendedQueryBuilder",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                "line": 198,
                "function": "moveFromCache",
                "class": "OC\\Files\\Cache\\Cache",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php",
                "line": 288,
                "function": "moveFromCache",
                "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                "line": 198,
                "function": "moveFromCache",
                "class": "OC\\Files\\Cache\\Wrapper\\CacheJail",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                "line": 198,
                "function": "moveFromCache",
                "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                "line": 178,
                "function": "moveFromCache",
                "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                "line": 225,
                "function": "OC\\Files\\Cache\\{closure}",
                "class": "OC\\Files\\Cache\\Updater",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                "line": 169,
                "function": "copyOrRenameFromStorage",
                "class": "OC\\Files\\Cache\\Updater",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                "line": 274,
                "function": "renameFromStorage",
                "class": "OC\\Files\\Cache\\Updater",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                "line": 815,
                "function": "renameUpdate",
                "class": "OC\\Files\\View",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
                "line": 418,
                "function": "rename",
                "class": "OC\\Files\\View",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php",
                "line": 178,
                "function": "moveInto",
                "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                "line": 612,
                "function": "move",
                "class": "Sabre\\DAV\\Tree",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                "line": 89,
                "function": "httpMove",
                "class": "Sabre\\DAV\\CorePlugin",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 472,
                "function": "emit",
                "class": "Sabre\\DAV\\Server",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Server.php",
                "line": 49,
                "function": "invokeMethod",
                "class": "Sabre\\DAV\\Server",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Server.php",
                "line": 398,
                "function": "start",
                "class": "OCA\\DAV\\Connector\\Sabre\\Server",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php",
                "line": 21,
                "function": "exec",
                "class": "OCA\\DAV\\Server",
                "type": "->"
            },
            {
                "file": "/data/homes/example.com/nextcloud/remote.php",
                "line": 145,
                "args": [
                    "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php"
                ],
                "function": "require_once"
            }
        ],
        "File": "/data/homes/example.com/nextcloud/lib/private/DB/Exceptions/DbalException.php",
        "Line": 56,
        "Previous": {
            "Exception": "Doctrine\\DBAL\\Exception\\DeadlockException",
            "Message": "An exception occurred while executing a query: SQLSTATE[40P01]: Deadlock detected: 7 ERROR:  deadlock detected\nDETAIL:  Process 227349 waits for ShareLock on transaction 76628760; blocked by process 227362.\nProcess 227362 waits for ShareLock on transaction 76628753; blocked by process 227349.\nHINT:  See server log for query details.\nCONTEXT:  while updating tuple (79273,3) in relation \"oc_filecache\"",
            "Code": 7,
            "Trace": [
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
                    "line": 1976,
                    "function": "convert",
                    "class": "Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
                    "line": 1918,
                    "function": "handleDriverException",
                    "class": "Doctrine\\DBAL\\Connection",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
                    "line": 1218,
                    "function": "convertExceptionDuringQuery",
                    "class": "Doctrine\\DBAL\\Connection",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
                    "line": 292,
                    "function": "executeStatement",
                    "class": "Doctrine\\DBAL\\Connection",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/DB/Connection.php",
                    "line": 466,
                    "function": "executeStatement",
                    "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/DB/ConnectionAdapter.php",
                    "line": 67,
                    "function": "executeStatement",
                    "class": "OC\\DB\\Connection",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
                    "line": 306,
                    "function": "executeStatement",
                    "class": "OC\\DB\\ConnectionAdapter",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php",
                    "line": 289,
                    "function": "executeStatement",
                    "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Cache.php",
                    "line": 773,
                    "function": "executeStatement",
                    "class": "OC\\DB\\QueryBuilder\\ExtendedQueryBuilder",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                    "line": 198,
                    "function": "moveFromCache",
                    "class": "OC\\Files\\Cache\\Cache",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php",
                    "line": 288,
                    "function": "moveFromCache",
                    "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                    "line": 198,
                    "function": "moveFromCache",
                    "class": "OC\\Files\\Cache\\Wrapper\\CacheJail",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                    "line": 198,
                    "function": "moveFromCache",
                    "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                    "line": 178,
                    "function": "moveFromCache",
                    "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                    "line": 225,
                    "function": "OC\\Files\\Cache\\{closure}",
                    "class": "OC\\Files\\Cache\\Updater",
                    "type": "->",
                    "args": [
                        "*** sensitive parameters replaced ***"
                    ]
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                    "line": 169,
                    "function": "copyOrRenameFromStorage",
                    "class": "OC\\Files\\Cache\\Updater",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                    "line": 274,
                    "function": "renameFromStorage",
                    "class": "OC\\Files\\Cache\\Updater",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                    "line": 815,
                    "function": "renameUpdate",
                    "class": "OC\\Files\\View",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
                    "line": 418,
                    "function": "rename",
                    "class": "OC\\Files\\View",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php",
                    "line": 178,
                    "function": "moveInto",
                    "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                    "line": 612,
                    "function": "move",
                    "class": "Sabre\\DAV\\Tree",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                    "line": 89,
                    "function": "httpMove",
                    "class": "Sabre\\DAV\\CorePlugin",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
                    "line": 472,
                    "function": "emit",
                    "class": "Sabre\\DAV\\Server",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Server.php",
                    "line": 49,
                    "function": "invokeMethod",
                    "class": "Sabre\\DAV\\Server",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Server.php",
                    "line": 398,
                    "function": "start",
                    "class": "OCA\\DAV\\Connector\\Sabre\\Server",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php",
                    "line": 21,
                    "function": "exec",
                    "class": "OCA\\DAV\\Server",
                    "type": "->"
                },
                {
                    "file": "/data/homes/example.com/nextcloud/remote.php",
                    "line": 145,
                    "args": [
                        "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php"
                    ],
                    "function": "require_once"
                }
            ],
            "File": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php",
            "Line": 35,
            "Previous": {
                "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
                "Message": "SQLSTATE[40P01]: Deadlock detected: 7 ERROR:  deadlock detected\nDETAIL:  Process 227349 waits for ShareLock on transaction 76628760; blocked by process 227362.\nProcess 227362 waits for ShareLock on transaction 76628753; blocked by process 227349.\nHINT:  See server log for query details.\nCONTEXT:  while updating tuple (79273,3) in relation \"oc_filecache\"",
                "Code": 7,
                "Trace": [
                    {
                        "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
                        "line": 132,
                        "function": "new",
                        "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
                        "type": "::"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
                        "line": 1212,
                        "function": "execute",
                        "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
                        "line": 292,
                        "function": "executeStatement",
                        "class": "Doctrine\\DBAL\\Connection",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/DB/Connection.php",
                        "line": 466,
                        "function": "executeStatement",
                        "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/DB/ConnectionAdapter.php",
                        "line": 67,
                        "function": "executeStatement",
                        "class": "OC\\DB\\Connection",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
                        "line": 306,
                        "function": "executeStatement",
                        "class": "OC\\DB\\ConnectionAdapter",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php",
                        "line": 289,
                        "function": "executeStatement",
                        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Cache.php",
                        "line": 773,
                        "function": "executeStatement",
                        "class": "OC\\DB\\QueryBuilder\\ExtendedQueryBuilder",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                        "line": 198,
                        "function": "moveFromCache",
                        "class": "OC\\Files\\Cache\\Cache",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php",
                        "line": 288,
                        "function": "moveFromCache",
                        "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                        "line": 198,
                        "function": "moveFromCache",
                        "class": "OC\\Files\\Cache\\Wrapper\\CacheJail",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                        "line": 198,
                        "function": "moveFromCache",
                        "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                        "line": 178,
                        "function": "moveFromCache",
                        "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                        "line": 225,
                        "function": "OC\\Files\\Cache\\{closure}",
                        "class": "OC\\Files\\Cache\\Updater",
                        "type": "->",
                        "args": [
                            "*** sensitive parameters replaced ***"
                        ]
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                        "line": 169,
                        "function": "copyOrRenameFromStorage",
                        "class": "OC\\Files\\Cache\\Updater",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                        "line": 274,
                        "function": "renameFromStorage",
                        "class": "OC\\Files\\Cache\\Updater",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                        "line": 815,
                        "function": "renameUpdate",
                        "class": "OC\\Files\\View",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
                        "line": 418,
                        "function": "rename",
                        "class": "OC\\Files\\View",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php",
                        "line": 178,
                        "function": "moveInto",
                        "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                        "line": 612,
                        "function": "move",
                        "class": "Sabre\\DAV\\Tree",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                        "line": 89,
                        "function": "httpMove",
                        "class": "Sabre\\DAV\\CorePlugin",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
                        "line": 472,
                        "function": "emit",
                        "class": "Sabre\\DAV\\Server",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Server.php",
                        "line": 49,
                        "function": "invokeMethod",
                        "class": "Sabre\\DAV\\Server",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Server.php",
                        "line": 398,
                        "function": "start",
                        "class": "OCA\\DAV\\Connector\\Sabre\\Server",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php",
                        "line": 21,
                        "function": "exec",
                        "class": "OCA\\DAV\\Server",
                        "type": "->"
                    },
                    {
                        "file": "/data/homes/example.com/nextcloud/remote.php",
                        "line": 145,
                        "args": [
                            "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php"
                        ],
                        "function": "require_once"
                    }
                ],
                "File": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
                "Line": 24,
                "Previous": {
                    "Exception": "PDOException",
                    "Message": "SQLSTATE[40P01]: Deadlock detected: 7 ERROR:  deadlock detected\nDETAIL:  Process 227349 waits for ShareLock on transaction 76628760; blocked by process 227362.\nProcess 227362 waits for ShareLock on transaction 76628753; blocked by process 227349.\nHINT:  See server log for query details.\nCONTEXT:  while updating tuple (79273,3) in relation \"oc_filecache\"",
                    "Code": "40P01",
                    "Trace": [
                        {
                            "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
                            "line": 130,
                            "function": "execute",
                            "class": "PDOStatement",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
                            "line": 1212,
                            "function": "execute",
                            "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
                            "line": 292,
                            "function": "executeStatement",
                            "class": "Doctrine\\DBAL\\Connection",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/DB/Connection.php",
                            "line": 466,
                            "function": "executeStatement",
                            "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/DB/ConnectionAdapter.php",
                            "line": 67,
                            "function": "executeStatement",
                            "class": "OC\\DB\\Connection",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
                            "line": 306,
                            "function": "executeStatement",
                            "class": "OC\\DB\\ConnectionAdapter",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/DB/QueryBuilder/ExtendedQueryBuilder.php",
                            "line": 289,
                            "function": "executeStatement",
                            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Cache.php",
                            "line": 773,
                            "function": "executeStatement",
                            "class": "OC\\DB\\QueryBuilder\\ExtendedQueryBuilder",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                            "line": 198,
                            "function": "moveFromCache",
                            "class": "OC\\Files\\Cache\\Cache",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheJail.php",
                            "line": 288,
                            "function": "moveFromCache",
                            "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                            "line": 198,
                            "function": "moveFromCache",
                            "class": "OC\\Files\\Cache\\Wrapper\\CacheJail",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php",
                            "line": 198,
                            "function": "moveFromCache",
                            "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                            "line": 178,
                            "function": "moveFromCache",
                            "class": "OC\\Files\\Cache\\Wrapper\\CacheWrapper",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                            "line": 225,
                            "function": "OC\\Files\\Cache\\{closure}",
                            "class": "OC\\Files\\Cache\\Updater",
                            "type": "->",
                            "args": [
                                "*** sensitive parameters replaced ***"
                            ]
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/Cache/Updater.php",
                            "line": 169,
                            "function": "copyOrRenameFromStorage",
                            "class": "OC\\Files\\Cache\\Updater",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                            "line": 274,
                            "function": "renameFromStorage",
                            "class": "OC\\Files\\Cache\\Updater",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/lib/private/Files/View.php",
                            "line": 815,
                            "function": "renameUpdate",
                            "class": "OC\\Files\\View",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",
                            "line": 418,
                            "function": "rename",
                            "class": "OC\\Files\\View",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php",
                            "line": 178,
                            "function": "moveInto",
                            "class": "OCA\\DAV\\Connector\\Sabre\\Directory",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                            "line": 612,
                            "function": "move",
                            "class": "Sabre\\DAV\\Tree",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                            "line": 89,
                            "function": "httpMove",
                            "class": "Sabre\\DAV\\CorePlugin",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
                            "line": 472,
                            "function": "emit",
                            "class": "Sabre\\DAV\\Server",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Connector/Sabre/Server.php",
                            "line": 49,
                            "function": "invokeMethod",
                            "class": "Sabre\\DAV\\Server",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/apps/dav/lib/Server.php",
                            "line": 398,
                            "function": "start",
                            "class": "OCA\\DAV\\Connector\\Sabre\\Server",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php",
                            "line": 21,
                            "function": "exec",
                            "class": "OCA\\DAV\\Server",
                            "type": "->"
                        },
                        {
                            "file": "/data/homes/example.com/nextcloud/remote.php",
                            "line": 145,
                            "args": [
                                "/data/homes/example.com/nextcloud/apps/dav/appinfo/v2/remote.php"
                            ],
                            "function": "require_once"
                        }
                    ],
                    "File": "/data/homes/example.com/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
                    "Line": 130
                }
            }
        },
        "message": "An exception occurred while executing a query: SQLSTATE[40P01]: Deadlock detected: 7 ERROR:  deadlock detected\nDETAIL:  Process 227349 waits for ShareLock on transaction 76628760; blocked by process 227362.\nProcess 227362 waits for ShareLock on transaction 76628753; blocked by process 227349.\nHINT:  See server log for query details.\nCONTEXT:  while updating tuple (79273,3) in relation \"oc_filecache\"",
        "exception": {
            "query": "UPDATE `*PREFIX*filecache` SET `path` = :dcValue1, `path_hash` = :dcValue2, `name` = :dcValue3, `parent` = :dcValue4, `storage` = :dcValue7 WHERE (`storage` = :dcValue5) AND (`fileid` = :dcValue6)"
        },
        "CustomMessage": "An exception occurred while executing a query: SQLSTATE[40P01]: Deadlock detected: 7 ERROR:  deadlock detected\nDETAIL:  Process 227349 waits for ShareLock on transaction 76628760; blocked by process 227362.\nProcess 227362 waits for ShareLock on transaction 76628753; blocked by process 227349.\nHINT:  See server log for query details.\nCONTEXT:  while updating tuple (79273,3) in relation \"oc_filecache\""
    }
}

Additional info

example response to

PROPFIND https://example.com/remote.php/dav/files/A/Y_Commun/
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/A/Y_Commun/</d:href><d:propstat><d:prop><d:getetag>&quot;6810757a503d8&quot;</d:getetag><d:getlastmodified>Tue, 29 Apr 2025 06:45:12 GMT</d:getlastmodified><d:creationdate>1970-01-01T00:00:00+00:00</d:creationdate><d:displayname>Y_Commun</d:displayname><d:quota-available-bytes>-3</d:quota-available-bytes><d:resourcetype><d:collection/></d:resourcetype><nc:has-preview>false</nc:has-preview><nc:mount-type>group</nc:mount-type><oc:comments-unread>0</oc:comments-unread><oc:favorite>0</oc:favorite><oc:fileid>3328766</oc:fileid><oc:owner-display-name>A</oc:owner-display-name><oc:owner-id>mig</oc:owner-id><oc:permissions>RMGDNVCK</oc:permissions><oc:size>214269215074</oc:size><nc:hidden>false</nc:hidden><nc:is-mount-root>true</nc:is-mount-root><nc:reminder-due-date></nc:reminder-due-date><nc:sharees/><nc:share-attributes>[]</nc:share-attributes><oc:share-types/><x1:share-permissions xmlns:x1="http://open-collaboration-services.org/ns">31</x1:share-permissions><nc:system-tags/><nc:rich-workspace></nc:rich-workspace><nc:rich-workspace-file></nc:rich-workspace-file></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontentlength/><d:getcontenttype/><nc:is-encrypted/><nc:metadata-blurhash/><nc:metadata-files-live-photo/><nc:note/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>

Also, in order to try to work around this, I performed the following commands

  • sudo -u www-data php -f /home/example.com/nextcloud/occ maintenance:repair --include-expensive
  • sudo -u www-data php -f /home/example.com/nextcloud/occ memories:index --retry
  • sudo -u www-data php -f /home/example.com/nextcloud/occ files:scan

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions