We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43738
    • 1 Posts
    Hi there,

    Please help! First off I must state that I am more a graphic designer than a developer so please go easy on me! When logging in to the Manager, it seems to take, on average, around 30 seconds to finally get through. When checking the Error Logs I get the following errors every time:

    -----------------------------------------------------------------------------------------------------------------------
    [2013-05-21 10:33:42] (ERROR @ /connectors/workspace/packages-rest.php) Could not connect to provider at: http://rest.modx.com/extras/

    [2013-05-21 10:37:02] (ERROR @ /manager/index.php) Error 22001 executing statement:
    UPDATE `modx_user_attributes` SET `failedlogincount` = 0,`logincount` = 1,`thislogin` = 1369129022,`sessionid` = 'bsje73p8poh1r7edg9rqf45drglnag5r2ndo21vd1qnaiklut2vbvllveoql719thi3tg79havatir1ct2s2g6b0dphq54dqkntoh23' WHERE `id` = 1
    Array
    (
    [0] => 22001
    [1] => 1406
    [2] => Data too long for column 'sessionid' at row 1
    )
    -----------------------------------------------------------------------------------------------------------------------


    My server setup is as follows, please ask if there is any info you might need that I have not included:

    Mac OSX 10.8 Server
    MODX Revolution 2.2.6-pl (traditional)(clean install, no add-ons yet)
    MySQL 5.6.10
    PHP 5.3.15



    I am already aware that the 'extras' error is likely to do with our service provider. We are a school and connect through our local authority. However the 'sessionid' error has me stumped! What could be causing this? How can I correct it? Other than slowing down the log in, could this issue cause further problems later down the line?

    Hoping someone out there might be able to advise me on what I need to do to fix this!

    Thanks in advance,

    Steve.
      • 48170
      • 6 Posts
      Hi, there:

      I have also been hit with this; my symptoms, however, are that I cannot get into the Manager at all! The login page simply reappears, with no error message anywhere. But I get this Error 22001 log message.

      I hope you got past this when you posted this a year ago, and you can tell me what was needed to squash this bug. The site is working fine, but we can't get into the manager to update the site or do any maintenance.

      Thanks!



      Quote from: loreto-webadmin at May 21, 2013, 05:39 AM
      Hi there,

      Please help! First off I must state that I am more a graphic designer than a developer so please go easy on me! When logging in to the Manager, it seems to take, on average, around 30 seconds to finally get through. When checking the Error Logs I get the following errors every time:

      -----------------------------------------------------------------------------------------------------------------------
      [2013-05-21 10:33:42] (ERROR @ /connectors/workspace/packages-rest.php) Could not connect to provider at: http://rest.modx.com/extras/

      [2013-05-21 10:37:02] (ERROR @ /manager/index.php) Error 22001 executing statement:
      UPDATE `modx_user_attributes` SET `failedlogincount` = 0,`logincount` = 1,`thislogin` = 1369129022,`sessionid` = 'bsje73p8poh1r7edg9rqf45drglnag5r2ndo21vd1qnaiklut2vbvllveoql719thi3tg79havatir1ct2s2g6b0dphq54dqkntoh23' WHERE `id` = 1
      Array
      (
      [0] => 22001
      [1] => 1406
      [2] => Data too long for column 'sessionid' at row 1
      )
      -----------------------------------------------------------------------------------------------------------------------


      My server setup is as follows, please ask if there is any info you might need that I have not included:

      Mac OSX 10.8 Server
      MODX Revolution 2.2.6-pl (traditional)(clean install, no add-ons yet)
      MySQL 5.6.10
      PHP 5.3.15



      I am already aware that the 'extras' error is likely to do with our service provider. We are a school and connect through our local authority. However the 'sessionid' error has me stumped! What could be causing this? How can I correct it? Other than slowing down the log in, could this issue cause further problems later down the line?

      Hoping someone out there might be able to advise me on what I need to do to fix this!

      Thanks in advance,

      Steve.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Clear all of your browser cookies for that domain.

        The session_start value is automatically generated by PHP and is stored in a cookie so that subsequent page requests will be accompanied by the cookie value so PHP knows which session to use.

        Usually any problems with this value indicates hacking attempts, since if these errors (illegal characters, too long, etc) are displayed they also include information of interest to the hacker sending the illegal values in his cookies. However, this particular error is because MODX stores its session in the database, and the id field is limited to 255 characters. Why your system's PHP is generating such a long session_id() string I don't know. There are several php.ini settings that may be causing this -

        http://php.net/manual/en/session.configuration.php


          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 48170
          • 6 Posts
          Thanks! I'll give it a shot tomorrow.

          I also note from the general help on the subject of what to do when the manager login doesn't allow you to proceed, but also doesn't throw an error message, that there are reasons to clear some of the xxxxx.cache.php files; should I also try to clear those working files out? Or are they unlikely to be a problem, since the fields listed in the help/rtfm link (http://rtfm.modx.com/revolution/2.x/getting-started/installation/troubleshooting-installation#TroubleshootingInstallation-Theloginpagekeepsredirectingmebacktotheloginscreenwithnoerror) are not in the [prefix]_system_settings table in my installation?

          Onward and upward, I guess.

          Frank
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I doubt if the MODX cache is a problem. The session_id is strictly a PHP thing, all that MODX is doing is storing it in the database instead of in files. Your problem is that PHP is creating a session_id string that is too long for the 256 character varchar field in the database. You could manually change the data type of the field in the database, but that's really not a good idea to meddle with.

            One thing that you can do is change your MODX configuration (System Settings) from using the database to using PHP's default files. Then the session_id is used as part of the filename, and nobody will care how long it is. Sometimes MODX's database session handler doesn't work well, depending on the server's configuration and a site's needs.

            http://rtfm.modx.com/revolution/2.x/administering-your-site/settings/system-settings/session_handler_class

            https://forums.modx.com/thread/84149/which-setting-for-the-session-handler-class

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 48170
              • 6 Posts
              Hi:

              Having looked at the server in detail, I now have a larger issue; is it possible that the manager would have a different session_id management setup than the default site? I get session_id storage (i.e., new randomly named files) in the designated folder whenever an HTTP request hits the server, and the PHP.INI session.save.handler = files, which mean that ModX is changing its mode of handling PHP sessions when I try to login as manager.

              Seems that I need to change something in the innards of ModX. The PHP docs are a little obscure on how to shorten the session_id, but I'll keep after that. But, once I'm in, it seems that I need to find the right ModX setting to ensure that the session_id goes back to "files" for the manager, too, so any pointers to which setting that would be (and insight into why one would have different settings for the manager and the standard HTTP requests to index.php) would be useful.

              Also: it appears that, based on the error.log, these strings are not more than 255 characters in length. With some PHP.INI machinations involving session.hash_function and session.hash_bits_per_character is can shorten the session_id (or, at least, what's reported in the error.log) down from 103 characters to 86, but I still can't get into the manager.

              It seems that I'll need to get into the ModX setting via MySQL and fix whatever makes the system change from using files to the database when entering the manager "by hand" -- so any pointers to the right settings will help me before I dive into the deep mechanisms of Revolution.

              Thanks!

              Frank [ed. note: frfurd last edited this post 12 years, 3 months ago.]
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                it's the session_handler_class setting. Just empty the value to use the default PHP file-based session handler. The table in question is (prefix)system_settings.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 48170
                  • 6 Posts
                  *sigh* No joy here. I have successfully set the "Session_handler_class" to null from "modSessionHandler"

                  mysql> select * from modx_system_settings where `key` = "session_handler_class";
                  +-----------------------+-------------------+-----------+-----------+---------+---------------------+
                  | key | value | xtype | namespace | area | editedon |
                  +-----------------------+-------------------+-----------+-----------+---------+---------------------+
                  | session_handler_class | modSessionHandler | textfield | core | session | 0000-00-00 00:00:00 |
                  +-----------------------+-------------------+-----------+-----------+---------+---------------------+
                  1 row in set (0.00 sec)

                  mysql> update modx_system_settings set `value` = "" where `key` = "session_handler_class";
                  Query OK, 1 row affected (0.00 sec)
                  Rows matched: 1 Changed: 1 Warnings: 0

                  mysql> select * from modx_system_settings where `key` = "session_handler_class";
                  +-----------------------+-------+-----------+-----------+---------+---------------------+
                  | key | value | xtype | namespace | area | editedon |
                  +-----------------------+-------+-----------+-----------+---------+---------------------+
                  | session_handler_class | | textfield | core | session | 2014-06-30 14:07:59 |
                  +-----------------------+-------+-----------+-----------+---------+---------------------+
                  1 row in set (0.00 sec)


                  But, when trying to log into the manager, I still get looped back to the manager login, with four successively more detailed efforts to write to the database, all failing with an error telling me that the "sessionid" is too long:

                  [2014-06-30 14:10:16] (ERROR @ /manager/index.php) Error 22001 executing statement:
                  UPDATE `modx_user_attributes` SET `logincount` = 5,`lastlogin` = 1404140284,`thislogin` = 1404151816,`sessionid` = '3qe1a62sogm6j3dp3r6gevm6r9c0c3flf6rthol9bf34s4074t1ost0o0rl5c6i30qjr1cma6dnmlsvh496j4htuvlg30986j912531' WHERE `id` = 3
                  Array
                  (
                  [0] => 22001
                  [1] => 1406
                  [2] => Data too long for column 'sessionid' at row 1
                  )

                  [2014-06-30 14:10:16] (ERROR @ /manager/index.php) Error 22001 executing statement:
                  INSERT INTO `modx_session` (`id`, `access`, `data`) VALUES ('3qe1a62sogm6j3dp3r6gevm6r9c0c3flf6rthol9bf34s4074t1ost0o0rl5c6i30qjr1cma6dnmlsvh496j4htuvlg30986j912531', 1404151816, 'modx.user.contextTokens|a:1:{s:3:\"mgr\";i:3;}usertype|s:7:\"manager\";mgrShortname|s:4:\"furd\";mgrFullname|s:11:\"Frank Field\";mgrEmail|s:12:\"[email protected]\";mgrValidated|i:1;mgrInternalKey|i:3;mgrFailedlogins|i:0;mgrLastlogin|i:1404139743;mgrLogincount|i:4;modx.mgr.session.cookie.lifetime|i:0;ip|s:11:\"18.48.0.121\";')
                  Array
                  (
                  [0] => 22001
                  [1] => 1406
                  [2] => Data too long for column 'id' at row 1
                  )

                  [2014-06-30 14:10:16] (ERROR @ /manager/index.php) Error 22001 executing statement:
                  INSERT INTO `modx_session` (`id`, `access`, `data`) VALUES ('3qe1a62sogm6j3dp3r6gevm6r9c0c3flf6rthol9bf34s4074t1ost0o0rl5c6i30qjr1cma6dnmlsvh496j4htuvlg30986j912531', 1404151816, 'modx.user.contextTokens|a:0:{}')
                  Array
                  (
                  [0] => 22001
                  [1] => 1406
                  [2] => Data too long for column 'id' at row 1
                  )

                  [2014-06-30 14:10:16] (ERROR @ /connectors/lang.js.php) Error 22001 executing statement:
                  INSERT INTO `modx_session` (`id`, `access`, `data`) VALUES ('3qe1a62sogm6j3dp3r6gevm6r9c0c3flf6rthol9bf34s4074t1ost0o0rl5c6i30qjr1cma6dnmlsvh496j4htuvlg30986j912531', 1404151816, 'modx.user..attributes|a:1:{s:3:\"mgr\";a:3:{s:16:\"modAccessContext\";a:1:{s:3:\"web\";a:1:{i:0;a:3:{s:9:\"principal\";i:0;s:9:\"authority\";s:1:\"0\";s:6:\"policy\";a:1:{s:4:\"load\";b:1;}}}}s:22:\"modAccessResourceGroup\";a:0:{}s:17:\"modAccessCategory\";a:0:{}}}mgrDocgroups|a:0:{}')
                  Array
                  (
                  [0] => 22001
                  [1] => 1406
                  [2] => Data too long for column 'id' at row 1
                  )


                  Note that, by Excel's count, that sessionid is "only" 103 characters in length.
                    • 48170
                    • 6 Posts
                    Also, the schema for mods_session explains the issue, but I have no idea how to get the sessionid to less than 83 characters:

                    id: varchar(40) PK
                    access: int(2) UN
                    data: mediumtext

                    So, I am guessing this is some sort of Mavericks thing that changed something in PHP that I have missed up until this point. But I can't see how to get below 40 for sessionIDs. The hashing system only goes up to 6 bits, and there only seem to be two default hash functions (MD5 and SHA-1) that can be set.
                      • 22303 MODX Staff
                      • 10,725 Posts