We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10525
    • 247 Posts
    Any advance on this issue?.. I'm getting 2 or 3 of these per minute in a 2.3.5 site.
      • 37638
      • 63 Posts
      I never got it solved. I did find that it did NOT appear to be causing issues, other than a full log.
        • 10525
        • 247 Posts
        Thanks.
        • Magnatron [Maarten Wolzak] Reply #14, 8 years, 2 months ago
          I ran into this and tracked it down to the use of
          $modx->getSessionState()
          If the session isn't available (yet), this message is logged as INFO. A bit confusing that the message itself states that it is an error.
          It's not an error, it's just a not-yet-existing session.
            • 45778
            • 75 Posts
            I'm bumping this thread to hopefully get some insight here. I see this all throughout my logs:

            INFO @ [path]/core/model/modx/modsessionhandler.class.php : 164) There was an error retrieving or creating session id: 0eshc4b7r3rm94ledpmcn9b3a7


            The part of the code in modsessionhandler.class.php generating the message is this:

            protected function _getSession($id, $autoCreate= false) {
                    $this->session= $this->modx->getObject('modSession', array('id' => $id), $this->cacheLifetime);
                    if ($autoCreate && !is_object($this->session)) {
                        $this->session= $this->modx->newObject('modSession');
                        $this->session->set('id', $id);
                    }
                    if (!($this->session instanceof modSession) || $id != $this->session->get('id') || !$this->session->validate()) {
                        $this->modx->log(modX::LOG_LEVEL_INFO, 'There was an error retrieving or creating session id: ' . $id);
                    }
                    return $this->session;
                }


            If I'm reading this right, the error is happening because the session is not valid, or at least not an instance of modSession. And yet, as far as I can tell, the site is working. Why is the session not being recognized as it should, and why is there no apparent consequence?

            ... or is there a consequence that I'm unaware of?
              • 45778
              • 75 Posts
              Or maybe I should back up: At what point in the MODX logic is this being called? And why does MODX seem to not care that the session is invalid according to the logic in the function above? What dependencies would break if the session is not an instance of modSession?
                • 3749
                • 24,544 Posts
                That's an odd one, especially since it is logged as INFO rather than ERROR. If the session were truly invalid, you wouldn't be able to log in to the Manager, since your login credentials are stored in a session variable.

                You might check to see if you can log in in the front end using the Login snippet, since it's possible that session handling only goes south in the front end. If that's the case, you might not be able to implement any permissions for front-end users.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 45778
                  • 75 Posts
                  Sorry for the late reply. The forum isn't emailing me notifications of new replies, despite the fact that I've checked the "email me new replies" checkbox, so I didn't know there was a response for me to read.

                  I am using the Login snippet already. It works, meaning that people can use it to log in to our site.

                  But, on a possibly related note, in the system settings, if I change anonymous_sessions to Off and then flush permissions, MODX memberof logic no longer works as expected.

                  The session itself is still alive for authenticated users until the permissions are flushed, at which time people can still see the password-protected pages, but something like this no longer works: [!+modx.user.id:memberof=`...`:then=`...`:else=`...`]] MODX won't recognize them as being a member of that group.

                  Is this behavior related error log message about sessions? I have no idea.
                    • 3749
                    • 24,544 Posts
                    I'm stumped as well. The only thing I can think of to suggest is an upgrade to MODX. If you're already up-to-date, you can use the UpgradeMODX extra to reinstall the current version by changing the 'settings_version' System Setting to an earlier version.

                    Is the Session Cache enabled? (cache_db_session System Setting)

                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 45778
                      • 75 Posts
                      Yes, cache_db_session is set to Yes. I'm running MODX 2.5.8, which is almost the latest version (I plan to upgrade this weekend), but I've been seeing the session error messages in the log for a long time now, going back several versions of MODX.