Skip to content

Conversation

@julien-nc
Copy link
Member

@julien-nc julien-nc commented Jan 27, 2023

Fix potential crash when trying to use the document session's user when the session is not found.

Maybe there's a better way to fix this if we identify the reason it happens and fix stuff in an upper level 😁.

I don't know when, but this is what happens:

{"reqId":"XXXXX","level":3,"time":"2023-01-27T09:47:02+00:00","remoteAddr":"XXXXX","user":"XXXXX","app":"index","method":"POST","url":"/apps/text/session/sync","message":"Call to a member function getUserId() on bool in file 'XXXXX/apps/text/lib/Controller/SessionController.php' line 116","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.76","version":"25.0.3.2","exception":{"Exception":"Exception","Message":"Call to a member function getUserId() on bool in file 'XXXXX/apps/text/lib/Controller/SessionController.php' line 116","Code":0,"Trace":[{"file":"XXXXX/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Text\\Controller\\SessionController"},"sync"]},{"file":"XXXXX/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Text\\Controller\\SessionController","sync",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},["text.Session.sync"]]},{"file":"XXXXX/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/text/session/sync"]},{"file":"XXXXX/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"XXXXX/lib/private/AppFramework/Http/Dispatcher.php","Line":165,"Previous":{"Exception":"Error","Message":"Call to a member function getUserId() on bool","Code":0,"Trace":[{"file":"XXXXX/nextcloud/apps/text/lib/Controller/SessionController.php","line":91,"function":"loginSessionUser","class":"OCA\\Text\\Controller\\SessionController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"XXXXX/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"sync","class":"OCA\\Text\\Controller\\SessionController","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***","*** sensitive parameters replaced ***",8,null,false,false]},{"file":"XXXXX/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Text\\Controller\\SessionController"},"sync"]},{"file":"XXXXX/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Text\\Controller\\SessionController"},"sync"]},{"file":"XXXXX/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Text\\Controller\\SessionController","sync",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},["text.Session.sync"]]},{"file":"XXXXX/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/text/session/sync"]},{"file":"XXXXX/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"XXXXX/apps/text/lib/Controller/SessionController.php","Line":116},"CustomMessage":"--"},"id":"63d39fcecf173"}

…en the session is not found

Signed-off-by: Julien Veyssier <[email protected]>
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Makes sense.

@juliusknorr
Copy link
Member

I could imagine this happens when the syncing still issues a request while the token is already invalidated or the session has been closed. I've seen this happening sometimes.

@cypress
Copy link

cypress bot commented Jan 27, 2023

Passing run #8329 ↗︎

0 116 0 0 Flakiness 0

Details:

Fix bug when session not found
Project: Text Commit: 1cc85e3fa7
Status: Passed Duration: 05:28 💡
Started: Jan 27, 2023 12:37 PM Ended: Jan 27, 2023 12:43 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@juliusknorr juliusknorr merged commit 93f8fa7 into main Jan 27, 2023
@delete-merged-branch delete-merged-branch bot deleted the fix/noid/login-session-failure branch January 27, 2023 14:29
@max-nextcloud
Copy link
Collaborator

/backport to stable25

@kesselb
Copy link
Contributor

kesselb commented Apr 16, 2024

Hi,

Found a similar error in a 24 error log.
Can we backport it?

{
  "url": "/apps/text/session/sync",
  "message": "Call to a member function getUserId() on bool in file '/var/www/html/nextcloud/apps/text/lib/Controller/SessionController.php' line 111",
  "version": "24.0.12.13",
  "exception": {
    "Exception": "Exception",
    "Message": "Call to a member function getUserId() on bool in file '/var/www/html/nextcloud/apps/text/lib/Controller/SessionController.php' line 111",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/html/nextcloud/lib/base.php",
        "line": 1035,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 165,
    "Previous": {
      "Exception": "Error",
      "Message": "Call to a member function getUserId() on bool",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/nextcloud/apps/text/lib/Controller/SessionController.php",
          "line": 105,
          "function": "loginSessionUser",
          "class": "OCA\\Text\\Controller\\SessionController",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 225,
          "function": "sync",
          "class": "OCA\\Text\\Controller\\SessionController",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 133,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
          "line": 172,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
          "line": 298,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/html/nextcloud/lib/base.php",
          "line": 1035,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/html/nextcloud/index.php",
          "line": 36,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/html/nextcloud/apps/text/lib/Controller/SessionController.php",
      "Line": 111
    },
    "CustomMessage": "--"
  }
}

@juliusknorr
Copy link
Member

/backport to stable24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants