Web session expires randomly

Nextcloud version (eg, 12.0.2): 17.0.1.1
Operating system and version (eg, Ubuntu 17.04): Ubuntu 18.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.29
PHP version (eg, 7.1): 7.2

The issue you are facing:

Web sessions expiring after a “while”. Can be days or hours. Sometimes seems to happen when changing network.
I’ve checked the forum but could not find a solution. I didn’t modify the session variables from the default, therefore the IMPLIED relevant config should be:

'remember_login_cookie_lifetime' => 60*60*24*15,
'session_lifetime' => 60 * 60 * 24,
'session_keepalive' => true,

I need help on how can I debug this because I cant figure out what the problem is.

Thanks!

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. No idea how to reproduce, happens randomly.

The output of your Nextcloud log in Admin > Logging:

No relevant logging can be provided

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

config.php
$ sh occ.sh config:list
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "17.0.1.1",
        "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "mail_smtpport": "25",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": false,
        "log_type": "file",
        "logfile": "\/srv\/nextcloud\/data\/nextcloud.log",
        "loglevel": "2",
        "log_rotate_size": 104857600,
        "log_query": false,
        "theme": "",
        "versions_retention_obligation": "auto",
        "app_install_overwrite": [
            "admin_notifications"
        ]
    },
    "apps": {
        "accessibility": {
            "enabled": "yes",
            "installed_version": "1.3.0",
            "types": ""
        },
        "activity": {
            "enable_email": "no",
            "enabled": "yes",
            "installed_version": "2.10.1",
            "notify_email_calendar": "0",
            "notify_email_calendar_event": "0",
            "notify_email_calendar_todo": "0",
            "notify_email_comments": "0",
            "notify_email_favorite": "0",
            "notify_email_file_changed": "0",
            "notify_email_file_created": "0",
            "notify_email_file_deleted": "0",
            "notify_email_file_restored": "0",
            "notify_email_public_links": "0",
            "notify_email_remote_share": "0",
            "notify_email_shared": "0",
            "notify_email_spreed": "0",
            "notify_email_systemtags": "0",
            "notify_setting_batchtime": "3600",
            "notify_setting_self": "1",
            "notify_setting_selfemail": "0",
            "notify_stream_calendar": "1",
            "notify_stream_calendar_event": "1",
            "notify_stream_calendar_todo": "1",
            "notify_stream_comments": "1",
            "notify_stream_favorite": "1",
            "notify_stream_file_changed": "1",
            "notify_stream_file_created": "1",
            "notify_stream_file_deleted": "1",
            "notify_stream_file_favorite": "0",
            "notify_stream_file_restored": "1",
            "notify_stream_public_links": "1",
            "notify_stream_remote_share": "1",
            "notify_stream_shared": "1",
            "notify_stream_spreed": "1",
            "notify_stream_systemtags": "1",
            "types": "filesystem"
        },
        "backgroundjob": {
            "lastjob": "31676"
        },
        "bookmarks": {
            "enabled": "yes",
            "installed_version": "2.3.4",
            "types": ""
        },
        "bruteforcesettings": {
            "enabled": "yes",
            "installed_version": "1.4.0",
            "types": ""
        },
        "calendar": {
            "enabled": "yes",
            "installed_version": "1.7.1",
            "types": ""
        },
        "cloud_federation_api": {
            "enabled": "yes",
            "installed_version": "1.0.0",
            "types": "filesystem"
        },
        "comments": {
            "enabled": "yes",
            "installed_version": "1.7.0",
            "types": "logging"
        },
        "contacts": {
            "enabled": "yes",
            "installed_version": "3.1.6",
            "types": ""
        },
        "core": {
            "backgroundjobs_mode": "cron",
            "default_encryption_module": "OC_DEFAULT_MODULE",
            "encryption_enabled": "yes",
            "enterpriseLogoChecked": "yes",
            "installed.bundles": "[\"CoreBundle\"]",
            "installedat": "1547320446.5494",
            "lastcron": "1576830302",
            "lastupdateResult": "{\"version\":\"17.0.2.1\",\"versionstring\":\"Nextcloud 17.0.2\",\"url\":\"https:\\\/\\\/download.nextcloud.com\\\/server\\\/releases\\\/nextcloud-17.0.2.zip\",\"web\":\"https:\\\/\\\/docs.nextcloud.com\\\/server\\\/17\\\/admin_manual\\\/maintenance\\\/upgrade.html\",\"changes\":\"https:\\\/\\\/updates.nextcloud.com\\\/changelog_server\\\/?version=17.0.2\",\"autoupdater\":\"1\",\"eol\":\"0\"}",
            "lastupdatedat": "1576830145",
            "oc.integritycheck.checker": "[]",
            "public_files": "files_sharing\/public.php",
            "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
            "scss.variables": "44db572444130029b7d5d718cb86aa8c",
            "shareapi_allow_resharing": "no",
            "shareapi_default_expire_date": "yes",
            "shareapi_default_permission_candelete": "no",
            "shareapi_default_permission_canshare": "no",
            "shareapi_default_permissions": "5",
            "shareapi_enforce_expire_date": "no",
            "theming.variables": "44db572444130029b7d5d718cb86aa8c",
            "updater.secret.created": "1575196593",
            "vendor": "nextcloud"
        },
        "dav": {
            "buildCalendarReminderIndex": "yes",
            "buildCalendarSearchIndex": "yes",
            "chunks_migrated": "1",
            "enabled": "yes",
            "installed_version": "1.13.0",
            "regeneratedBirthdayCalendarsForYearFix": "yes",
            "types": "filesystem"
        },
        "encryption": {
            "enabled": "yes",
            "installed_version": "2.5.0",
            "masterKeyId": "master_67c886e8",
            "publicShareKeyId": "pubShare_67c886e8",
            "recoveryKeyId": "recoveryKey_67c886e8",
            "types": "filesystem"
        },
        "end_to_end_encryption": {
            "enabled": "no",
            "installed_version": "1.1.0",
            "types": "filesystem"
        },
        "federatedfilesharing": {
            "enabled": "yes",
            "installed_version": "1.7.0",
            "types": ""
        },
        "federation": {
            "enabled": "yes",
            "installed_version": "1.7.0",
            "types": "authentication"
        },
        "files": {
            "cronjob_scan_files": "500",
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": "filesystem"
        },
        "files_markdown": {
            "enabled": "yes",
            "installed_version": "2.1.0",
            "types": ""
        },
        "files_pdfviewer": {
            "enabled": "yes",
            "installed_version": "1.6.0",
            "types": ""
        },
        "files_rightclick": {
            "enabled": "yes",
            "installed_version": "0.15.1",
            "types": ""
        },
        "files_sharing": {
            "enabled": "yes",
            "installed_version": "1.9.0",
            "types": "filesystem"
        },
        "files_texteditor": {
            "enabled": "no",
            "installed_version": "2.8.0",
            "types": ""
        },
        "files_trashbin": {
            "enabled": "no",
            "installed_version": "1.6.0",
            "types": "filesystem,dav"
        },
        "files_versions": {
            "enabled": "yes",
            "installed_version": "1.10.0",
            "types": "filesystem,dav"
        },
        "files_videoplayer": {
            "enabled": "yes",
            "installed_version": "1.6.0",
            "types": ""
        },
        "firstrunwizard": {
            "enabled": "yes",
            "installed_version": "2.6.0",
            "types": "logging"
        },
        "gallery": {
            "enabled": "yes",
            "installed_version": "18.4.0",
            "types": ""
        },
        "gpxpod": {
            "enabled": "yes",
            "installed_version": "4.1.0",
            "types": ""
        },
        "impersonate": {
            "enabled": "no",
            "installed_version": "1.4.0",
            "types": ""
        },
        "logreader": {
            "enabled": "yes",
            "installed_version": "2.2.0",
            "live": "1",
            "types": ""
        },
        "lookup_server_connector": {
            "enabled": "yes",
            "installed_version": "1.5.0",
            "types": "authentication"
        },
        "news": {
            "enabled": "yes",
            "installed_version": "14.0.2",
            "types": ""
        },
        "nextcloud_announcements": {
            "enabled": "yes",
            "installed_version": "1.6.0",
            "pub_date": "Thu, 24 Oct 2019 00:00:00 +0200",
            "types": "logging"
        },
        "notes": {
            "enabled": "yes",
            "installed_version": "3.0.3",
            "types": ""
        },
        "notifications": {
            "enabled": "yes",
            "installed_version": "2.5.0",
            "types": "logging"
        },
        "oauth2": {
            "enabled": "yes",
            "installed_version": "1.5.0",
            "types": "authentication"
        },
        "ocsms": {
            "enabled": "no",
            "installed_version": "2.1.3",
            "types": ""
        },
        "password_policy": {
            "enabled": "yes",
            "enforceNumericCharacters": "1",
            "enforceUpperLowerCase": "1",
            "installed_version": "1.7.0",
            "minLength": "12",
            "types": ""
        },
        "privacy": {
            "enabled": "yes",
            "installed_version": "1.1.0",
            "types": ""
        },
        "provisioning_api": {
            "enabled": "yes",
            "installed_version": "1.7.0",
            "types": "prevent_group_restriction"
        },
        "recommendations": {
            "enabled": "no",
            "installed_version": "0.4.0",
            "types": ""
        },
        "richdocuments": {
            "doc_format": "ooxml",
            "enabled": "no",
            "installed_version": "3.4.6",
            "types": "filesystem,dav,prevent_group_restriction",
            "wopi_url": "https:\/\/***REMOVED SENSITIVE VALUE***"
        },
        "serverinfo": {
            "enabled": "yes",
            "installed_version": "1.7.0",
            "types": ""
        },
        "sharebymail": {
            "enabled": "yes",
            "enforcePasswordProtection": "yes",
            "installed_version": "1.7.0",
            "types": "filesystem"
        },
        "spreed": {
            "enabled": "no",
            "installed_version": "5.0.0",
            "stun_servers": "***REMOVED SENSITIVE VALUE***",
            "types": "prevent_group_restriction"
        },
        "support": {
            "enabled": "yes",
            "installed_version": "1.0.1",
            "types": "session"
        },
        "survey_client": {
            "enabled": "yes",
            "installed_version": "1.5.0",
            "last_report": ...",
            "last_sent": "1575116103",
            "types": ""
        },
        "systemtags": {
            "enabled": "yes",
            "installed_version": "1.7.0",
            "types": "logging"
        },
        "tasks": {
            "enabled": "yes",
            "installed_version": "0.11.3",
            "types": ""
        },
        "text": {
            "enabled": "yes",
            "installed_version": "1.1.1",
            "types": ""
        },
        "theming": {
            "cachebuster": "15",
            "color": "#00C200",
            "enabled": "yes",
            "faviconMime": "image\/jpeg",
            "installed_version": "1.8.0",
            "logoMime": "image\/png",
            "name": "....",
            "slogan": "***REMOVED SENSITIVE VALUE***",
            "types": "logging",
            "url": "***REMOVED SENSITIVE VALUE***"
        },
        "twofactor_backupcodes": {
            "enabled": "yes",
            "installed_version": "1.6.0",
            "types": ""
        },
        "twofactor_totp": {
            "enabled": "yes",
            "installed_version": "4.1.1",
            "types": ""
        },
        "updatenotification": {
            "bookmarks": "2.3.4",
            "bruteforcesettings": "1.4.0",
            "calendar": "1.7.1",
            "contacts": "3.1.6",
            "core": "17.0.1.1",
            "enabled": "yes",
            "files_markdown": "2.1.0",
            "files_rightclick": "0.13.0",
            "gpxpod": "4.1.0",
            "installed_version": "1.7.0",
            "news": "14.0.2",
            "notes": "3.0.3",
            "richdocuments": "3.3.8",
            "tasks": "0.11.3",
            "twofactor_totp": "4.1.1",
            "types": "",
            "update_check_errors": "1"
        },
        "viewer": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": ""
        },
        "workflowengine": {
            "enabled": "yes",
            "installed_version": "1.7.0",
            "types": "filesystem"
        }
    }
}

The output of your Apache/nginx/system log in /var/log/____:

no relevant log con be provided