Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid unitialized access of fts manager properties #43826

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Feb 26, 2024

The merge of #38996 broke integration tests in deck as we emit events for full text search:

{
  "reqId": "1lFMfuGdFInBWE4ELIOf",
  "level": 3,
  "time": "2024-02-26T06:50:26+00:00",
  "remoteAddr": "192.168.65.1",
  "user": "user0",
  "app": "deck",
  "method": "POST",
  "url": "/index.php/apps/deck/boards/6/acl",
  "message": "Exception thrown: Exception",
  "userAgent": "GuzzleHttp/7",
  "version": "29.0.0.5",
  "exception": {
    "Exception": "Exception",
    "Message": "Typed property OC\\FullTextSearch\\FullTextSearchManager::$indexService must not be accessed before initialization in file '/var/www/html/lib/private/FullTextSearch/FullTextSearchManager.php' line 99",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Deck\\Controller\\BoardController"
          ],
          "addAcl"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 338,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Deck\\Controller\\BoardController",
          "addAcl",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "6",
            "deck.board.addacl"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1059,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/deck/boards/6/acl"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 49,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 170,
    "Previous": {
      "Exception": "Error",
      "Message": "Typed property OC\\FullTextSearch\\FullTextSearchManager::$indexService must not be accessed before initialization",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/FullTextSearch/FullTextSearchManager.php",
          "line": 182,
          "function": "getIndexService",
          "class": "OC\\FullTextSearch\\FullTextSearchManager",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/apps-extra/deck/lib/Listeners/FullTextSearchEventListener.php",
          "line": 99,
          "function": "updateIndexesStatus",
          "class": "OC\\FullTextSearch\\FullTextSearchManager",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php",
          "line": 86,
          "function": "handle",
          "class": "OCA\\Deck\\Listeners\\FullTextSearchEventListener",
          "type": "->",
          "args": [
            [
              "OCA\\Deck\\Event\\AclCreatedEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 230,
          "function": "__invoke",
          "class": "OC\\EventDispatcher\\ServiceEventListener",
          "type": "->",
          "args": [
            [
              "OCA\\Deck\\Event\\AclCreatedEvent"
            ],
            "OCA\\Deck\\Event\\AclCreatedEvent",
            [
              "Symfony\\Component\\EventDispatcher\\EventDispatcher"
            ]
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 59,
          "function": "callListeners",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              [
                "Closure"
              ],
              [
                "Closure"
              ],
              [
                "Closure"
              ]
            ],
            "OCA\\Deck\\Event\\AclCreatedEvent",
            [
              "OCA\\Deck\\Event\\AclCreatedEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 86,
          "function": "dispatch",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              "OCA\\Deck\\Event\\AclCreatedEvent"
            ],
            "OCA\\Deck\\Event\\AclCreatedEvent"
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 98,
          "function": "dispatch",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "OCA\\Deck\\Event\\AclCreatedEvent",
            [
              "OCA\\Deck\\Event\\AclCreatedEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/apps-extra/deck/lib/Service/BoardService.php",
          "line": 463,
          "function": "dispatchTyped",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              "OCA\\Deck\\Event\\AclCreatedEvent"
            ]
          ]
        },
        {
          "file": "/var/www/html/apps-extra/deck/lib/Controller/BoardController.php",
          "line": 128,
          "function": "addAcl",
          "class": "OCA\\Deck\\Service\\BoardService",
          "type": "->",
          "args": [
            "6",
            0,
            "user1",
            false,
            false,
            false
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 232,
          "function": "addAcl",
          "class": "OCA\\Deck\\Controller\\BoardController",
          "type": "->",
          "args": [
            "6",
            0,
            "user1",
            false,
            false,
            false
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 138,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            [
              "OCA\\Deck\\Controller\\BoardController"
            ],
            "addAcl"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            [
              "OCA\\Deck\\Controller\\BoardController"
            ],
            "addAcl"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 338,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Deck\\Controller\\BoardController",
            "addAcl",
            [
              "OC\\AppFramework\\DependencyInjection\\DIContainer"
            ],
            [
              "6",
              "deck.board.addacl"
            ]
          ]
        },
        {
          "file": "/var/www/html/lib/base.php",
          "line": 1059,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/apps/deck/boards/6/acl"
          ]
        },
        {
          "file": "/var/www/html/index.php",
          "line": 49,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/var/www/html/lib/private/FullTextSearch/FullTextSearchManager.php",
      "Line": 99
    },
    "CustomMessage": "Exception thrown: Exception"
  }
}

@juliusknorr juliusknorr added bug 3. to review Waiting for reviews labels Feb 26, 2024
@juliusknorr juliusknorr added this to the Nextcloud 29 milestone Feb 26, 2024
@juliusknorr juliusknorr requested a review from blizzz February 26, 2024 06:59
Copy link
Member

@fsamapoor fsamapoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this issue wasn't caught in the test suite before merging the PR, but I appreciate your effort in addressing it.

@juliusknorr
Copy link
Member Author

Likely because there are no tests covering this in server 🙈

@skjnldsv skjnldsv enabled auto-merge February 26, 2024 08:35
@skjnldsv skjnldsv merged commit 71997bc into master Feb 26, 2024
159 checks passed
@skjnldsv skjnldsv deleted the fix/fts-initialization branch February 26, 2024 09:05
@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants