nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.71k stars 4k forks source link

Problem loading page, reloading in 5 seconds #23110

Closed sigmoidal closed 3 years ago

sigmoidal commented 3 years ago

This is an issue that has been going on for years regarding interminent appearance of a message "Problem loading page, reloading in 5 seconds" when logged into the web interface, with an immediate disconnection. This happens for me usually very quickly after login and seems to be related to session termination. The desktop clients are not affected.

This problem has cropped up before [#5274, #3419, #1759, #964], but I decided against necroposting and I hope this one remains open until the issue is properly addressed.

The core issue here seems to be the inability of nextcloud web app to work with sessions when PHP is configured to use anything but "files" as the session handler (in php.ini). I tried both with a perfectly working memcached and redis server, same behavior:

(a) I need to sometimes login in twice via the web login form to actully browse the files. (b) Once logged in, I being disconnected and dropped out after a few seconds. The message: "Problem loading page, reloading in 5 seconds" appears on the top right.

Workaround The only method that seems to work is to switch the php.ini configuration back to using session.save_handler=files and session.save_path="/tmp" (which of course is not optimal given a server may be serving other apps that can tremendously benefit by memcached or redis session storage).

Steps to reproduce

  1. Have a working memcached (v1.6.6) server on 127.0.0.1:11211, PHP-FPM 7.3 (v7.3.22) setup and Apache 2.4 (v2.4.46)
  2. Edit into php.ini session.save_handler=memcached and session.save_path="127.0.0.1:11211"
  3. Reload the php fpm daemon.
  4. Login via the nextcloud web form.
  5. Browse around the files.

Expected behaviour

Should remain logged in.

Actual behaviour

Session is terminated. User has to log in again (only to be disconnected after a few seconds)

Server configuration

Operating system: up to date Gentoo x64

Web server: Apache 2.4.46

Database: MySQL 8.0.20

PHP version: PHP v7.3.22 (FPM)

Nextcloud version: (see Nextcloud admin page) 19.0.3

Updated from an older Nextcloud/ownCloud or fresh install: Been updating since maybe v9

Where did you install Nextcloud from: portage (gentoo package manager)

Login as admin user into your Nextcloud and access http://example.com/index.php/settings/integrity/failed paste the results here.

"No errors have been found."

App list **List of activated apps:** Enabled: - accessibility: 1.5.0 - activity: 2.12.0 - admin_audit: 1.9.0 - cloud_federation_api: 1.2.0 - comments: 1.9.0 - contactsinteraction: 1.0.0 - dav: 1.15.0 - federatedfilesharing: 1.9.0 - federation: 1.9.0 - files: 1.14.0 - files_pdfviewer: 1.8.0 - files_rightclick: 0.16.0 - files_sharing: 1.11.0 - files_trashbin: 1.9.0 - files_versions: 1.12.0 - files_videoplayer: 1.8.0 - firstrunwizard: 2.8.0 - logreader: 2.4.0 - lookup_server_connector: 1.7.0 - notifications: 2.7.0 - oauth2: 1.7.0 - password_policy: 1.9.1 - photos: 1.1.0 - privacy: 1.3.0 - provisioning_api: 1.9.0 - serverinfo: 1.9.0 - settings: 1.1.0 - sharebymail: 1.9.0 - support: 1.2.1 - survey_client: 1.7.0 - systemtags: 1.9.0 - text: 3.0.1 - theming: 1.10.0 - twofactor_backupcodes: 1.8.0 - updatenotification: 1.9.0 - user_ldap: 1.9.0 - viewer: 1.3.0 - workflowengine: 2.1.0 Disabled: - bruteforcesettings - encryption - files_external - nextcloud_announcements - recommendations

Nextcloud configuration:

Config report ``` { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "localhost", "***REMOVED SENSITIVE VALUE***" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "19.0.3.1", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "forcessl": true, "log_type": "file", "logfile": "\/var\/log\/nextcloud.log", "loglevel": 0, "syslog_tag": "Nextcloud", "theme": "", "maintenance": false, "tempdirectory": "\/tmp", "secret": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_smtpauthtype": "LOGIN", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "25", "ldapIgnoreNamingRules": false, "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory", "mysql.utf8mb4": true, "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379, "dbindex": 4 }, "memcached_servers": [ [ "127.0.0.1", 11211 ] ], "updatechecker": false, "updater.release.channel": "stable" } } ```

Are you using external storage, if yes which one: local/smb/sftp/... No

Are you using encryption: yes/no No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... No

Client configuration

Browser: Chrome 85

Operating system: Win 10 Pro

Logs

Web server error log

Web server error log ``` There are no errors logged! ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` no entries are generated in the nextcloud log either. ```

Browser log

Browser log ![browser_log](https://user-images.githubusercontent.com/6106332/94691247-c058db00-0339-11eb-92dd-edb345060bf6.jpg)
brunob commented 3 years ago

Seems related to #13431

skjnldsv commented 3 years ago

Could you see if there is a failed request on your browser network?

I will need your browser console log to investigate this issue. Open your console, reload your page and/or do the action leading to this issue and copy/paste the log in this thread.

How to access your browser console (Click to expand) # Chrome - Press either CTRL + SHIFT + J to open the “console” tab of the Developer Tools. - Alternative method: 1. Press either CTRL + SHIFT + I or F12 to open the Developer Tools. 2. Click the “console” tab. # Safari - Press CMD + ALT + I to open the Web Inspector. - See Chrome’s step 2. (Chrome and Safari have pretty much identical dev tools.) # IE9 1. Press F12 to open the developer tools. 2. Click the “console” tab. # Firefox - Press CTRL + SHIFT + K to open the Web console (COMMAND + SHIFT + K on Macs). - or, if Firebug is installed (recommended): 1. Press F12 to open Firebug. 2. Click on the “console” tab. # Opera 1. Press CTRL + SHIFT + I to open Dragonfly. 2. Click on the “console” tab.

I will also need a screenshot of your network requests. Before you do anything, still on the development tools, there is a tab called network. Click on it. Do your action and screenshot the network log like this: capture d ecran_2018-09-27_21-49-46

ghGuillaume commented 3 years ago

Hello,

Having the same issue as sigmoidal, here are the errors in my console log, using Xubuntu 18.04 and Chromium 86:

VM40 files.js:50 GET https://nextcloud.mydomain.fr/ocs/v2.php/apps/text/workspace?path=%2F 404 (Not Found) (anonymous) @ VM40 files.js:50 e.exports @ VM40 files.js:50 e.exports @ VM40 files.js:50 Promise.then (async) c.request @ VM40 files.js:50 r.forEach.c. @ VM40 files.js:50 (anonymous) @ VM40 files.js:50 getFileInfo @ VM40 files.js:23 (anonymous) @ VM40 files.js:23 c @ VM63 files_sharing_tab.js:1 (anonymous) @ VM63 files_sharing_tab.js:1 forEach.e. @ VM63 files_sharing_tab.js:1 u @ VM40 files.js:23 a @ VM40 files.js:23 (anonymous) @ VM40 files.js:23 (anonymous) @ VM40 files.js:23 mounted @ VM40 files.js:23 We @ VM40 files.js:50 nn @ VM40 files.js:50 (anonymous) @ VM40 files.js:50 On.$mount @ VM40 files.js:50 On.$mount @ VM40 files.js:50 (anonymous) @ VM40 files.js:45 Promise.then (async) render @ VM40 files.js:45 (anonymous) @ VM37 merged-index.js:4328 setTimeout (async) (anonymous) @ VM37 merged-index.js:4327 initHeadersAndFooters @ VM37 merged-index.js:4318 initialize @ VM37 merged-index.js:4306 FileList @ VM37 merged-index.js:3899 initialize @ VM37 merged-index.js:80 (anonymous) @ VM37 merged-index.js:338 (anonymous) @ VM22 main.js:1 setTimeout (async) (anonymous) @ VM22 main.js:1 (anonymous) @ VM22 main.js:1 Se @ VM22 main.js:1 i @ VM22 main.js:1 (anonymous) @ VM37 merged-index.js:337 c @ VM22 main.js:1 fireWith @ VM22 main.js:1 ready @ VM22 main.js:1 P @ VM22 main.js:1 VM100 main.js:1 GET https://nextcloud.mydomain.fr/index.php/apps/files/ajax/getstoragestats.php?dir=%2F 401 (Unauthorized) send @ VM100 main.js:1 ajax @ VM100 main.js:1 m.each.m. @ VM100 main.js:1 getJSON @ VM100 main.js:1 _updateStorageStatistics @ VM115 merged-index.js:7842 updateStorageStatistics @ VM115 merged-index.js:7874 updateStorageStatistics @ VM115 merged-index.js:6023 reloadCallback @ VM115 merged-index.js:5995 (anonymous) @ VM100 main.js:1 c @ VM100 main.js:1 fireWith @ VM100 main.js:1 Deferred.m.each.r. @ VM100 main.js:1 (anonymous) @ VM113 client.js:502 Promise.then (async) getFolderContents @ VM113 client.js:495 reload @ VM115 merged-index.js:5933 changeDirectory @ VM115 merged-index.js:5789 _onUrlChanged @ VM115 merged-index.js:4632 Se @ VM100 main.js:1 (anonymous) @ VM100 main.js:1 (anonymous) @ VM100 main.js:1 dispatch @ VM100 main.js:1 v.handle @ VM100 main.js:1 trigger @ VM100 main.js:1 e.event.trigger @ VM100 main.js:1 (anonymous) @ VM100 main.js:1 each @ VM100 main.js:1 each @ VM100 main.js:1 trigger @ VM100 main.js:1 _onPopState @ VM115 merged-index.js:297 initialize @ VM115 merged-index.js:125 (anonymous) @ VM115 merged-index.js:338 (anonymous) @ VM100 main.js:1 setTimeout (async) (anonymous) @ VM100 main.js:1 (anonymous) @ VM100 main.js:1 Se @ VM100 main.js:1 i @ VM100 main.js:1 (anonymous) @ VM115 merged-index.js:337 c @ VM100 main.js:1 fireWith @ VM100 main.js:1 ready @ VM100 main.js:1 P @ VM100 main.js:1 VM127 main.js:13 GET https://nextcloud.mydomain.fr/index.php/apps/recommendations/api/recommendations 401 (Unauthorized) (anonymous) @ VM127 main.js:13 t.exports @ VM127 main.js:13 t.exports @ VM127 main.js:13 Promise.then (async) c.request @ VM127 main.js:13 r.forEach.c. @ VM127 main.js:13 (anonymous) @ VM127 main.js:13 (anonymous) @ VM127 main.js:33 c @ VM141 files_sharing_tab.js:1 (anonymous) @ VM141 files_sharing_tab.js:1 forEach.e. @ VM141 files_sharingtab.js:1 @ VM127 main.js:13 a @ VM127 main.js:13 (anonymous) @ VM127 main.js:13 (anonymous) @ VM127 main.js:13 fetchRecommendations @ VM127 main.js:33 (anonymous) @ VM127 main.js:7 u.dispatch @ VM127 main.js:13 dispatch @ VM127 main.js:7 render @ VM127 main.js:55 (anonymous) @ VM115 merged-index.js:4328 setTimeout (async) (anonymous) @ VM115 merged-index.js:4327 initHeadersAndFooters @ VM115 merged-index.js:4318 initialize @ VM115 merged-index.js:4306 FileList @ VM115 merged-index.js:3899 initialize @ VM115 merged-index.js:80 (anonymous) @ VM115 merged-index.js:338 (anonymous) @ VM100 main.js:1 setTimeout (async) (anonymous) @ VM100 main.js:1 (anonymous) @ VM100 main.js:1 Se @ VM100 main.js:1 i @ VM100 main.js:1 (anonymous) @ VM115 merged-index.js:337 c @ VM100 main.js:1 fireWith @ VM100 main.js:1 ready @ VM100 main.js:1 P @ VM100 main.js:1 VM127 main.js:13 Uncaught (in promise) Error: Request failed with status code 401 at t.exports (VM127 main.js:13) at t.exports (VM127 main.js:13) at XMLHttpRequest.d.onreadystatechange (VM127 main.js:13) t.exports @ VM127 main.js:13 t.exports @ VM127 main.js:13 d.onreadystatechange @ VM127 main.js:13 Promise.then (async) u.dispatch @ VM127 main.js:13 dispatch @ VM127 main.js:7 render @ VM127 main.js:55 (anonymous) @ VM115 merged-index.js:4328 setTimeout (async) (anonymous) @ VM115 merged-index.js:4327 initHeadersAndFooters @ VM115 merged-index.js:4318 initialize @ VM115 merged-index.js:4306 FileList @ VM115 merged-index.js:3899 initialize @ VM115 merged-index.js:80 (anonymous) @ VM115 merged-index.js:338 (anonymous) @ VM100 main.js:1 setTimeout (async) (anonymous) @ VM100 main.js:1 (anonymous) @ VM100 main.js:1 Se @ VM100 main.js:1 i @ VM100 main.js:1 (anonymous) @ VM115 merged-index.js:337 c @ VM100 main.js:1 fireWith @ VM100 main.js:1 ready @ VM100 main.js:1 P @ VM100 main.js:1

Do you need the full log?

And the network requests: nextcloud-disconnection-error-network-requests

Thank you very much, please advise if this report should be done differently.

skjnldsv commented 3 years ago

VM100 main.js:1 GET nextcloud.mydomain.fr/index.php/apps/files/ajax/getstoragestats.php?dir=%2F 401 (Unauthorized)

Those ones are the needed one. On your screenshot I only see the cron.php one

jf34000 commented 3 years ago

Hi, Same problem. Same server than ghGuillaume, but other Nextcloud's instances. Here are few observations i deed :

22:02:28,844 XHRGEThttps://cloud.bienensemble.fr/cron.php [HTTP/1.1 200 OK 2283ms] 22:02:29,566 [DEBUG] unified-search: Unified Search initialized with the following providers Object { 0: {…}, 1: {…}, 2: {…}, 3: {…}, 4: {…}, 5: {…}, 6: {…}, 7: {…}, 8: {…}, 9: {…}, … } ConsoleLogger.js:42:18 22:02:30,008 XHRPROPFINDhttps://cloud.bienensemble.fr/remote.php/dav/principals/users/administrateur/ [HTTP/1.1 401 Unauthorized 2258ms] PROPFIND https://cloud.bienensemble.fr/remote.php/dav/principals/users/administrateur/ État401 Unauthorized VersionHTTP/1.1 Transfert833 o (taille 235 o)

Content-Security-Policy
    default-src 'none';
Content-Type
    application/xml; charset=utf-8
Date
    Sun, 22 Nov 2020 21:02:30 GMT
Referrer-Policy
    no-referrer
Server
    Apache/2.4.25 (Debian)
Set-Cookie
    oc70tshk64zh=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
Transfer-Encoding
    chunked
WWW-Authenticate
    DummyBasic realm="Nextcloud"
X-Content-Type-Options
    nosniff
X-Download-Options
    noopen
X-Frame-Options
    SAMEORIGIN
X-Permitted-Cross-Domain-Policies
    none
X-Powered-By
    PHP/7.4.10
X-Robots-Tag
    none
X-XSS-Protection
    1; mode=block

Accept
    */*
Accept-Encoding
    gzip, deflate, br
Accept-Language
    fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Connection
    keep-alive
Content-Length
    1497
Content-Type
    application/xml; charset=utf-8
Cookie
    __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true; oc_sessionPassphrase=MO3TCK3OR3oXgvReuWTZkcFw7jez29YDpB5vNA1b2goasIkjHSgDOylnqfiBoNE9Dg72CYYa4hK%2Bq960hHnQsMauhm0LFiSFcogbuS88I%2FkCdcbr6Zk4gMgKOAUwti6C; oc70tshk64zh=ieskf33tc6svf3s4ik4l74d20d; nc_username=administrateur; nc_token=AUy2V4zdvHykd%2BE0506RGF0D%2FpDnuWEU; nc_session_id=ieskf33tc6svf3s4ik4l74d20d
Depth
    0
DNT
    1
Host
    cloud.bienensemble.fr
Origin
    https://cloud.bienensemble.fr
requesttoken
    BvaKjtEJegJXnXduZp1SVYw/xZHDEABnhpgkb3dJEF4=:Tb/DzKF4P28wqBFbVtg0GfpG8cuZIys2suxrARN9JBA=
User-Agent
    Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0
X-NC-CalDAV-Webcal-Caching
    On
X-Requested-With
    XMLHttpRequest

22:02:38,422 Ouverture de https://cloud.bienensemble.fr/index.php/apps/dashboard/ 22:02:38,540 GEThttps://cloud.bienensemble.fr/index.php/apps/dashboard/ 22:02:55,528 XHRGEThttps://cloud.bienensemble.fr/ocs/v2.php/apps/notifications/api/v2/notifications [HTTP/1.1 401 Unauthorized 3871ms]

Hope it could help ! JF

skjnldsv commented 3 years ago

Please show the response of the unauthorised request (401) :)

jf34000 commented 3 years ago

Hi, Here are the screenshot with the response : one of the "console tab", one of the "network tab". Is it what you are asking for ?

Capture du 2020-11-23 12-20-22 Capture du 2020-11-23 12-22-59

skjnldsv commented 3 years ago

According to the forum, this is a configuration issue

https://help.nextcloud.com/t/upload-impossible-cannot-authentificate-over-ajax-calls/65730/3

Reminders

sigmoidal commented 3 years ago

I tried to make screenshots of the problem, but there is nothing useful I can grab for you before the user gets disconnected. The 401 errors appear after the user is logged out. Apparently, the response of the first 401 error occuring in my system is fairly random. One of them for https://nextcloud.server/ocs/v2.php/apps/notifications/api/v2/notifications had a response

{"ocs":{"meta":{"status":"failure","statuscode":997,"message":"Current user is not logged in"},"data":[]}}

Other times (and because it randomly the user gets logged out) I see at https://nextcloud.server/apps/text/session/sync

{"message":"CSRF check failed"}

which is also exactly what you get if you try to access the url when not logged in. This happens with other urls.

@skjnldsv sure maybe it is a configuration issue, but the particular post provides little help or clues on what was the actual problem of that user, i.e. which part of the configuration was wrong?

What is curious is that when sessions are stored in "files", instead of memcached, without any web server configuration modifications it works like a charm.

Has someone from the dev team ever tried to reproduce it? I have more than one servers with the same problem (and it actually happens with redis also). If you cannot reproduce it and memcached works fine, maybe you could post your configs and we can then compare it to ours?

skjnldsv commented 3 years ago

Has someone from the dev team ever tried to reproduce it? I have more than one servers with the same problem (and it actually happens with redis also). If you cannot reproduce it and memcached works fine, maybe you could post your configs and we can then compare it to ours?

We're all using the exact config from the documentation. If you're not, you must have a good reason to do so.

Please share your config.php as well as php/webserver config

sigmoidal commented 3 years ago

Ok here they are.

nextcloud-timeout-config.zip

walterzilla commented 3 years ago

Just today I tried to install a new instance - as already done flawless at other times - and I got this very issue!

Brand new Debian 10 LXC with apache 2.4.38 (proper mods enabled, canonical vhost) and PHP 7.3 (proper extensions enabled).

Update: after further tests, seems to be a trivial browser-related issue since in Private mode and in other browers all is fine...time to clear cache and such...doh!

sysoppl commented 3 years ago

Same for me, it started happening after switching from chrome to firefox. I'm using docker image

ghost commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

sigmoidal commented 3 years ago

This is inaccurate: "seems to be missing some essential information".

ghost commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.