Skip to content

[Bug]: On Log out I always get: "... ignoring session_start() because a session is already active ..." #36083

Closed

Description

@ro56

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

on every logout from nextcloud server the following error message is being logged:
[PHP] Error: session_start(): Ignoring session_start() because a session is already active at /var/www/nextcloud/lib/private/Session/Internal.php#219

GET /logout?requesttoken=jEq2TSqVpriFh35iGNX5SUyfMTZGqrYLNCX%2FEdjcu9U%3D%3A43r0PhLC8vH8xB0jQZ2TEw7PXHclnuJAB3WvR7Gl3oQ%3D
from 84.118.244.93 at 2023-01-11T10:54:55+00:00

Steps to reproduce

  1. simply log out from server and watch log

Expected behavior

no error log

Installation method

Official All-in-One appliance

Operating system

Other

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud66.dynv6.net",
            "route66.dynv6.net",
            "cloud66.ddnss.de",
            "route66.ddnss.de",
            "nextcloud.fritz.box",
            "cloud66.spdns.eu",
            "route66.spdns.eu",
            "nextcloud",
            "192.168.178.21",
            "2a02:908:2732:c860:201:2eff:fe70:c744"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "25.0.2.3",
        "overwrite.cli.url": "https:\/\/cloud66.dynv6.net",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "DE",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\APCu",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\ACPu",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "theme": "",
        "loglevel": 2,
        "updater.release.channel": "stable",
        "encryption.legacy_format_support": false,
        "encryption.key_storage_migrated": false,
        "trashbin_retention_obligation": "auto,180",
        "app_install_overwrite": [
            "radio"
        ],
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls"
    }
}

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"hVwaI6Umwt1IMGDU7AIc","level":3,"time":"2023-01-11T10:54:55+00:00","remoteAddr":"84.118.244.93","user":"--","app":"PHP","method":"GET","url":"/logout?requesttoken=jEq2TSqVpriFh35iGNX5SUyfMTZGqrYLNCX%2FEdjcu9U%3D%3A43r0PhLC8vH8xB0jQZ2TEw7PXHclnuJAB3WvR7Gl3oQ%3D","message":"session_start(): Ignoring session_start() because a session is already active at /var/www/nextcloud/lib/private/Session/Internal.php#219","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","version":"25.0.2.3","data":{"app":"PHP"},"id":"63be9a466401b"}

Additional info

No response

Activity

  1. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Jan 11, 2023
  2. solracsf commented on Jan 11, 2023

    @solracsf
    Member

    An app could be the cause of this. Try the following:

    1. Login
    2. Disable an app (try 1st those not marked as "Featured" on the Apps list)
    3. Logout and see if error is gone.

    Repeat until you've tried all apps.

  3. ro56 commented on Jan 11, 2023

    @ro56
    Author

    The bug seems to be caused by SnappyMail, after disabling it there are no more error messages.

  4. solracsf commented on Jan 11, 2023

    @solracsf
    Member

    Related: the-djmaze/snappymail#813
    But please report it or in that topic, or in a new issue on that repository.

  5. ro56 commented on Jan 11, 2023

    @ro56
    Author
  6. the-djmaze commented on Jan 18, 2023

    @the-djmaze

    @solracsf i found the problem that happens on logout.
    There are three session_start requests:

    1. OC::initSession
    2. OC\Session\CryptoSessionData::reopen
    3. OC\Session\CryptoSessionData::clear (this one throws the session_start error)

    So the Nextcloud session handler has a bug and doesn't handle session_status() or other properly.

    [18-Jan-2023 16:36:51 UTC] session_start: Array
    (
        [0] => Array
            (
                [file] => /nextcloud/lib/private/Session/Internal.php
                [line] => 56
                [function] => startSession
                [class] => OC\Session\Internal
                [type] => ->
            )
    
        [1] => Array
            (
                [file] => /nextcloud/lib/base.php
                [line] => 434
                [function] => __construct
                [class] => OC\Session\Internal
                [type] => ->
            )
    
        [2] => Array
            (
                [file] => /nextcloud/lib/base.php
                [line] => 676
                [function] => initSession
                [class] => OC
                [type] => ::
            )
    
        [3] => Array
            (
                [file] => /nextcloud/lib/base.php
                [line] => 1144
                [function] => init
                [class] => OC
                [type] => ::
            )
    
        [4] => Array
            (
                [file] => /nextcloud/index.php
                [line] => 34
                [args] => Array
                    (
                        [0] => /nextcloud/lib/base.php
                    )
    
                [function] => require_once
            )
    
    )
    
    [18-Jan-2023 16:36:51 UTC] session_start: Array
    (
        [0] => Array
            (
                [file] => /nextcloud/lib/private/Session/Internal.php
                [line] => 181
                [function] => startSession
                [class] => OC\Session\Internal
                [type] => ->
            )
    
        [1] => Array
            (
                [file] => /nextcloud/lib/private/Session/CryptoSessionData.php
                [line] => 166
                [function] => reopen
                [class] => OC\Session\Internal
                [type] => ->
            )
    
        [2] => Array
            (
                [file] => /nextcloud/lib/private/AppFramework/Middleware/SessionMiddleware.php
                [line] => 55
                [function] => reopen
                [class] => OC\Session\CryptoSessionData
                [type] => ->
            )
    
        [3] => Array
            (
                [file] => /nextcloud/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php
                [line] => 97
                [function] => beforeController
                [class] => OC\AppFramework\Middleware\SessionMiddleware
                [type] => ->
            )
    
        [4] => Array
            (
                [file] => /nextcloud/lib/private/AppFramework/Http/Dispatcher.php
                [line] => 125
                [function] => beforeController
                [class] => OC\AppFramework\Middleware\MiddlewareDispatcher
                [type] => ->
            )
    
        [5] => Array
            (
                [file] => /nextcloud/lib/private/AppFramework/App.php
                [line] => 172
                [function] => dispatch
                [class] => OC\AppFramework\Http\Dispatcher
                [type] => ->
            )
    
        [6] => Array
            (
                [file] => /nextcloud/lib/private/Route/Router.php
                [line] => 298
                [function] => main
                [class] => OC\AppFramework\App
                [type] => ::
            )
    
        [7] => Array
            (
                [file] => /nextcloud/lib/base.php
                [line] => 1047
                [function] => match
                [class] => OC\Route\Router
                [type] => ->
            )
    
        [8] => Array
            (
                [file] => /nextcloud/index.php
                [line] => 36
                [function] => handleRequest
                [class] => OC
                [type] => ::
            )
    
    )
    
    [18-Jan-2023 16:36:51 UTC] session_start loaded twice: Array
    (
        [0] => Array
            (
                [file] => /nextcloud/lib/private/Session/Internal.php
                [line] => 110
                [function] => startSession
                [class] => OC\Session\Internal
                [type] => ->
            )
    
        [1] => Array
            (
                [file] => /nextcloud/lib/private/Session/CryptoSessionData.php
                [line] => 162
                [function] => clear
                [class] => OC\Session\Internal
                [type] => ->
            )
    
        [2] => Array
            (
                [file] => /nextcloud/lib/private/User/Session.php
                [line] => 939
                [function] => clear
                [class] => OC\Session\CryptoSessionData
                [type] => ->
            )
    
        [3] => Array
            (
                [file] => /nextcloud/core/Controller/LoginController.php
                [line] => 117
                [function] => logout
                [class] => OC\User\Session
                [type] => ->
            )
    
        [4] => Array
            (
                [file] => /nextcloud/lib/private/AppFramework/Http/Dispatcher.php
                [line] => 225
                [function] => logout
                [class] => OC\Core\Controller\LoginController
                [type] => ->
            )
    
        [5] => Array
            (
                [file] => /nextcloud/lib/private/AppFramework/Http/Dispatcher.php
                [line] => 133
                [function] => executeController
                [class] => OC\AppFramework\Http\Dispatcher
                [type] => ->
            )
    
        [6] => Array
            (
                [file] => /nextcloud/lib/private/AppFramework/App.php
                [line] => 172
                [function] => dispatch
                [class] => OC\AppFramework\Http\Dispatcher
                [type] => ->
            )
    
        [7] => Array
            (
                [file] => /nextcloud/lib/private/Route/Router.php
                [line] => 298
                [function] => main
                [class] => OC\AppFramework\App
                [type] => ::
            )
    
        [8] => Array
            (
                [file] => /nextcloud/lib/base.php
                [line] => 1047
                [function] => match
                [class] => OC\Route\Router
                [type] => ->
            )
    
        [9] => Array
            (
                [file] => /nextcloud/index.php
                [line] => 36
                [function] => handleRequest
                [class] => OC
                [type] => ::
            )
    
    )
    
  7. added a commit that references this issue on Jan 19, 2023
  8. daffydock commented on Mar 27, 2023

    @daffydock

    I hope this issue gets fixed soon, as I am as well getting the same error on Snappymail due to the session_start requests.

  9. joshtrichards commented on Jul 24, 2023

    @joshtrichards
    Member

    Isn't this a duplicate of #35930?

  10. ro56 commented on Jul 24, 2023

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap25-feedbackbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions