Newly created office-files are locked and not editable/deletable

Nextcloud version: 27.1.5.1
Operating system and version: CentOS 7
Apache or nginx version : Apache/2.4.6 (CentOS)
PHP version: 8.1


When creating a new document (odt/ods/odp/…) via the NC-WebGUI the file is created and opened with Collabora/the Office app.
When the page has loaded, a few seconds afterwards the following errormessage pops up:
The document can not be saved, please check your permissions
(this is translated, so the actual english errormessage might differ slightly).

The error started around the beginning of the week when we still had an older version of NC installed, so this should not be a bug in the NC-version, I guess. Also this works on another server with the same NC-version.

The richdocuments-app is the newest (8.2.3) as is the Collabora Online version on the server (coolwsd-23.05.6.4-1.x86_64).

The logs say the file is locked:

{
  "reqId": "ZYWlYGsAqAVBjzOzAfE4ogAAAAg",
  "level": 3,
  "time": "2023-12-22T16:04:02+01:00",
  "remoteAddr": "<IP>",
  "user": "username",
  "app": "richdocuments",
  "method": "POST",
  "url": "/index.php/apps/richdocuments/wopi/files/5057061_oc4ad32a936a/contents?access_token=2KwS6K4SYMiGHZ0KrOZSYIv1xFnu6q6O&access_token_ttl=0",
  "message": "Exception thrown: OCP\\Lock\\LockedException",
  "userAgent": "COOLWSD HTTP Agent 23.05.6.4",
  "version": "27.1.5.1",
  "exception": {
    "Exception": "OCP\\Lock\\LockedException",
    "Message": "\"doc.odt\" is locked, existing lock on file: 2 shared locks",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/View.php",
        "line": 647,
        "function": "changeLock",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Node/File.php",
        "line": 73,
        "function": "file_put_contents",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 513,
        "function": "putContent",
        "class": "OC\\Files\\Node\\File",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 805,
        "function": "OCA\\Richdocuments\\Controller\\{closure}",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 782,
        "function": "retryOperation",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Lock/LockManager.php",
        "line": 29,
        "function": "OCA\\Richdocuments\\Controller\\{closure}",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 785,
        "function": "runInScope",
        "class": "OC\\Files\\Lock\\LockManager",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 514,
        "function": "wrappedFilesystemOperation",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "putFile",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
        "line": 183,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/html/nextcloud/lib/base.php",
        "line": 1068,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/index.php",
        "line": 38,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/html/nextcloud/lib/private/Files/View.php",
    "Line": 1984,
    "Previous": {
      "Exception": "OCP\\Lock\\LockedException",
      "Message": "\"files/c8b3d96991ddd8fb4a422579e5d8591d\"(\"files/doc.odt\") is locked, existing lock on file: 2 shared locks",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 629,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Common",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 629,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/Files/View.php",
          "line": 1978,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/Files/View.php",
          "line": 647,
          "function": "changeLock",
          "class": "OC\\Files\\View",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/Files/Node/File.php",
          "line": 73,
          "function": "file_put_contents",
          "class": "OC\\Files\\View",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
          "line": 513,
          "function": "putContent",
          "class": "OC\\Files\\Node\\File",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
          "line": 805,
          "function": "OCA\\Richdocuments\\Controller\\{closure}",
          "class": "OCA\\Richdocuments\\Controller\\WopiController",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
          "line": 782,
          "function": "retryOperation",
          "class": "OCA\\Richdocuments\\Controller\\WopiController",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/Files/Lock/LockManager.php",
          "line": 29,
          "function": "OCA\\Richdocuments\\Controller\\{closure}",
          "class": "OCA\\Richdocuments\\Controller\\WopiController",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
          "line": 785,
          "function": "runInScope",
          "class": "OC\\Files\\Lock\\LockManager",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
          "line": 514,
          "function": "wrappedFilesystemOperation",
          "class": "OCA\\Richdocuments\\Controller\\WopiController",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 230,
          "function": "putFile",
          "class": "OCA\\Richdocuments\\Controller\\WopiController",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 137,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
          "line": 183,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
          "line": 315,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/html/nextcloud/lib/base.php",
          "line": 1068,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/index.php",
          "line": 38,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/html/nextcloud/lib/private/Files/Storage/Common.php",
      "Line": 833,
      "Previous": {
        "Exception": "OCP\\Lock\\LockedException",
        "Message": "\"files/c8b3d96991ddd8fb4a422579e5d8591d\" is locked, existing lock on file: 2 shared locks",
        "Code": 0,
        "Trace": [
          {
            "file": "/var/www/html/nextcloud/lib/private/Files/Storage/Common.php",
            "line": 831,
            "function": "changeLock",
            "class": "OC\\Lock\\MemcacheLockingProvider",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
            "line": 629,
            "function": "changeLock",
            "class": "OC\\Files\\Storage\\Common",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
            "line": 629,
            "function": "changeLock",
            "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Files/View.php",
            "line": 1978,
            "function": "changeLock",
            "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Files/View.php",
            "line": 647,
            "function": "changeLock",
            "class": "OC\\Files\\View",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Files/Node/File.php",
            "line": 73,
            "function": "file_put_contents",
            "class": "OC\\Files\\View",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
            "line": 513,
            "function": "putContent",
            "class": "OC\\Files\\Node\\File",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
            "line": 805,
            "function": "OCA\\Richdocuments\\Controller\\{closure}",
            "class": "OCA\\Richdocuments\\Controller\\WopiController",
            "type": "->",
            "args": [
              "*** sensitive parameters replaced ***"
            ]
          },
          {
            "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
            "line": 782,
            "function": "retryOperation",
            "class": "OCA\\Richdocuments\\Controller\\WopiController",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Files/Lock/LockManager.php",
            "line": 29,
            "function": "OCA\\Richdocuments\\Controller\\{closure}",
            "class": "OCA\\Richdocuments\\Controller\\WopiController",
            "type": "->",
            "args": [
              "*** sensitive parameters replaced ***"
            ]
          },
          {
            "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
            "line": 785,
            "function": "runInScope",
            "class": "OC\\Files\\Lock\\LockManager",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
            "line": 514,
            "function": "wrappedFilesystemOperation",
            "class": "OCA\\Richdocuments\\Controller\\WopiController",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 230,
            "function": "putFile",
            "class": "OCA\\Richdocuments\\Controller\\WopiController",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 137,
            "function": "executeController",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
            "line": 183,
            "function": "dispatch",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
            "line": 315,
            "function": "main",
            "class": "OC\\AppFramework\\App",
            "type": "::"
          },
          {
            "file": "/var/www/html/nextcloud/lib/base.php",
            "line": 1068,
            "function": "match",
            "class": "OC\\Route\\Router",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/index.php",
            "line": 38,
            "function": "handleRequest",
            "class": "OC",
            "type": "::"
          }
        ],
        "File": "/var/www/html/nextcloud/lib/private/Lock/MemcacheLockingProvider.php",
        "Line": 109
      }
    },
    "CustomMessage": "Exception thrown: OCP\\Lock\\LockedException"
  }
}

The memcache/locking config of our server:

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
     'host' => 'localhost',
     'port' => 6379,
     'timeout' => 0.0,
  ),

The richdocuments-app config:

MariaDB [nextcloud]> select * from oc_appconfig where appid='richdocuments';
+---------------+-------------------+----------------------------------------+
| appid         | configkey         | configvalue                            |
+---------------+-------------------+----------------------------------------+
| richdocuments | enabled           | yes                                    |
| richdocuments | installed_version | 8.2.3                                  |
| richdocuments | public_wopi_url   | https://collabora.<domain>.de |
| richdocuments | types             | prevent_group_restriction              |
| richdocuments | wopi_url          | https://collabora.<domain>.de |
+---------------+-------------------+----------------------------------------+

When trying to find a solution I did the following:

  • alter filelocking-settings (we use REDIS, I changed it to APCu) → did not resolve the issue
  • disable filelocking in total (did solve the issue, but yeah - no filelocking, which we do not want)

Therefore the problem seems to be, that newly created files are locked and I cannot edit (or delete!) them for some minutes. The lock vanishes after some time (which should be the normale behaviour, since there is a timeout for locks) and from that moment on everything works as intended.

When I upload a document and do not create it with the builtin “New” Button in NC, everything works as intended.


Anyone has an idea? As mentioned before we have another NC-server where all involved versions are the same and it does work there.

You’ve got me stumped here! :confused:
Thank you in advance!