nextcloud / nextcloud/cookbook

Error 500 when browsing cookbook

Open
#1,655 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug investigation-required
Dominant language
HTML
Stars
641
Forks
113
Avg merge
21h 31m
Merged PRs (30d)
26

Description

Description
Sometimes I get a error 500 when browsing cookbook app.
Most of the time it works.

Some specialities on my Setup:

  • Redis
  • Groupfolders (main recipie folder)
  • SAML Backend

I already read this issues. They seem related:
#871 #968

I understand the following log line, that the app wants to create the folder "Rezepte" but it already exists!?
Looks like some Problem with Groupfolders?

I extracted this line from the Nextcloud logs:
{
  "reqId": "Fr0Fz154266de5eKMw5O",
  "level": 3,
  "time": "2023-05-04T19:04:27+00:00",
  "remoteAddr": "10.10.20.57",
  "user": "cthulhu",
  "app": "index",
  "method": "GET",
  "url": "/apps/cookbook/",
  "message": "\"Rezepte\" is locked, existing lock on file: none",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0",
  "version": "26.0.1.1",
  "exception": {
    "Exception": "OCP\\Lock\\LockedException",
    "Message": "\"Rezepte\" is locked, existing lock on file: none",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 1171,
        "function": "changeLock",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 272,
        "function": "basicOperation",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
        "line": 165,
        "function": "mkdir",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "function": "newFolder",
        "class": "OC\\Files\\Node\\Folder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/LazyFolder.php",
        "line": 72,
        "function": "call_user_func_array"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/LazyFolder.php",
        "line": 419,
        "function": "__call",
        "class": "OC\\Files\\Node\\LazyFolder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/cookbook/lib/Helper/UserFolderHelper.php",
        "line": 116,
        "function": "newFolder",
        "class": "OC\\Files\\Node\\LazyFolder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/cookbook/lib/Helper/UserFolderHelper.php",
        "line": 105,
        "function": "getOrCreateFolder",
        "class": "OCA\\Cookbook\\Helper\\UserFolderHelper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/cookbook/lib/Controller/MainController.php",
        "line": 45,
        "function": "getFolder",
        "class": "OCA\\Cookbook\\Helper\\UserFolderHelper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "index",
        "class": "OCA\\Cookbook\\Controller\\MainController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 183,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1056,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Files/View.php",
    "Line": 2018,
    "Previous": {
      "Exception": "OCP\\Lock\\LockedException",
      "Message": "\"files/4bbeb6cb0098ed4ca79725b0fa8773df\" is locked, existing lock on file: none",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/nextcloud/lib/private/Files/Storage/Common.php",
          "line": 826,
          "function": "changeLock",
          "class": "OC\\Lock\\MemcacheLockingProvider",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 629,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Common",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Jail.php",
          "line": 469,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 629,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Jail",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 629,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 629,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
          "line": 629,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/View.php",
          "line": 2012,
          "function": "changeLock",
          "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/View.php",
          "line": 1171,
          "function": "changeLock",
          "class": "OC\\Files\\View",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/View.php",
          "line": 272,
          "function": "basicOperation",
          "class": "OC\\Files\\View",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
          "line": 165,
          "function": "mkdir",
          "class": "OC\\Files\\View",
          "type": "->"
        },
        {
          "function": "newFolder",
          "class": "OC\\Files\\Node\\Folder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Node/LazyFolder.php",
          "line": 72,
          "function": "call_user_func_array"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Files/Node/LazyFolder.php",
          "line": 419,
          "function": "__call",
          "class": "OC\\Files\\Node\\LazyFolder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/cookbook/lib/Helper/UserFolderHelper.php",
          "line": 116,
          "function": "newFolder",
          "class": "OC\\Files\\Node\\LazyFolder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/cookbook/lib/Helper/UserFolderHelper.php",
          "line": 105,
          "function": "getOrCreateFolder",
          "class": "OCA\\Cookbook\\Helper\\UserFolderHelper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/cookbook/lib/Controller/MainController.php",
          "line": 45,
          "function": "getFolder",
          "class": "OCA\\Cookbook\\Helper\\UserFolderHelper",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 230,
          "function": "index",
          "class": "OCA\\Cookbook\\Controller\\MainController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 137,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 183,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 315,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1056,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 36,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/lib/private/Lock/MemcacheLockingProvider.php",
      "Line": 109
    },
    "CustomMessage": "--"
  }
}

Reproduction
Steps to reproduce the behavior (not tested):

  1. Install Groupfolders App
  2. Setup Redis as Nextcloud locking system
  3. Navigate to cookbook multiple times

Expected behavior
There shouldn't be a error 500.

Actual behavior
Sometimes I get error 500.
After a reload everything is fine.

Screenshots
grafik

Browser
Firefox 112

Versions
Nextcloud server version: 26.1
Cookbook version: 0.10.2
Database system: MariaDB

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/cookbook/lib/Helper/UserFolderHelper.php around lines 105-116 and the call from lib/Controller/MainController.php line 45. Reproduce repeated cookbook navigation with Groupfolders and Redis locking, then trace the intermittent LockedException. Done means browsing the cookbook no longer intermittently returns a 500 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, redis
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.