[GH-ISSUE #432] Not loading settings or mail until logout and login is done #358

Closed
opened 2026-02-25 21:34:50 +03:00 by kerem · 12 comments
Owner

Originally created by @kk6mrp on GitHub (Sep 18, 2020).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/432

Originally assigned to: @jasonmunro on GitHub.

🐛 Bugreport

Likely there is something I am doing wrong here but I can't seem to find the issue. When opening Cypht in a new tab or browser window at the first login it loads the main Cypht page however it says, "You don't have any data sources assigned to this page." and my user settings are not loaded. After logging out and logging back in, I see data sources and settings loaded like normal. Here is the log files for after the first login:

[Fri Sep 18 03:04:03.597207 2020] [php7:notice] [pid 16527] [client 127.0.0.1:46828] Array\n(\n    [0] => Using Hm_DB_Session with Hm_Auth_DB\n    [1] => Using DB user configuration\n    [2] => Using sapi: apache2handler\n    [3] => Request type: HTTP\n    [4] => Request path: /\n    [5] => TLS request: 1\n    [6] => Mobile request: 0\n    [7] => Page ID: home\n    [8] => Redis enabled but not supported by PHP\n    [9] => Memcached enabled but not supported by PHP\n    [10] => CACHE backend using: noop\n    [11] => Missing configuration setting for db_user\n    [12] => Missing configuration setting for db_pass\n    [13] => Connecting to dsn: sqlite:/var/lib/cypht/app_data/cypht.db\n    [14] => Setting cookie: name: hm_id, lifetime: 0, path: /, domain: mail.domain.com, secure: 1, html_only 1\n    [15] => Missing configuration setting for db_user\n    [16] => Missing configuration setting for db_pass\n    [17] => Setting cookie: name: hm_session, lifetime: 0, path: /, domain: mail.domain.com, secure: 1, html_only 1\n    [18] => LOGGED IN\n    [19] => Missing configuration setting for db_user\n    [20] => Missing configuration setting for db_pass\n    [21] => Redirecting to ?page=message_list&list_path=combined_inbox\n    [22] => PHP version 7.2.24-0ubuntu0.18.04.6\n    [23] => Zend version 3.2.0\n    [24] => Peak Memory: 6144\n    [25] => PID: 16527\n    [26] => Included files: 72\n)\n, referer: https://mail.domain.com/
[Fri Sep 18 03:04:03.909934 2020] [php7:notice] [pid 16527] [client 127.0.0.1:46828] Array\n(\n    [0] => Using Hm_DB_Session with Hm_Auth_DB\n    [1] => Using DB user configuration\n    [2] => Using sapi: apache2handler\n    [3] => Request type: HTTP\n    [4] => Request path: /\n    [5] => TLS request: 1\n    [6] => Mobile request: 0\n    [7] => Page ID: message_list\n    [8] => Redis enabled but not supported by PHP\n    [9] => Memcached enabled but not supported by PHP\n    [10] => CACHE backend using: noop\n    [11] => Missing configuration setting for db_user\n    [12] => Missing configuration setting for db_pass\n    [13] => Connecting to dsn: sqlite:/var/lib/cypht/app_data/cypht.db\n    [14] => LOGGED IN\n    [15] => CACHE: miss for "feed_read_uids" using noop\n    [16] => TYPE CONVERSION: boolean to string for username\n    [17] => TRANSLATION NOT FOUND :Date:\n    [18] => PHP version 7.2.24-0ubuntu0.18.04.6\n    [19] => Zend version 3.2.0\n    [20] => Peak Memory: 2048\n    [21] => PID: 16527\n    [22] => Included files: 74\n)\n, referer: https://mail.domain.com/
[Fri Sep 18 03:04:04.307549 2020] [php7:notice] [pid 16527] [client 127.0.0.1:46828] Array\n(\n    [0] => Using Hm_DB_Session with Hm_Auth_DB\n    [1] => Using DB user configuration\n    [2] => Using sapi: apache2handler\n    [3] => Request type: AJAX\n    [4] => Request path: /\n    [5] => TLS request: 1\n    [6] => Mobile request: 0\n    [7] => Page ID: ajax_hm_folders\n    [8] => Redis enabled but not supported by PHP\n    [9] => Memcached enabled but not supported by PHP\n    [10] => CACHE backend using: noop\n    [11] => Missing configuration setting for db_user\n    [12] => Missing configuration setting for db_pass\n    [13] => Connecting to dsn: sqlite:/var/lib/cypht/app_data/cypht.db\n    [14] => LOGGED IN\n    [15] => CACHE: miss for "feed_read_uids" using noop\n    [16] => TRANSLATION NOT FOUND :Hide folders:\n    [17] => PHP version 7.2.24-0ubuntu0.18.04.6\n    [18] => Zend version 3.2.0\n    [19] => Peak Memory: 4096\n    [20] => PID: 16527\n    [21] => Included files: 82\n)\n

I did notice after the first login there are two cookies, hm_id and hm_session. After logging out I see four cookies, hm_id, hm_msgs, hm_reload_folders, and hm_session. After logging in again there are two cookies, hm_id and hm_session.

If I have logged out and logged back in I can open more new tabs and load Cypht. If I have logged in and back out and then open a new tab to log in the third time, I have to repeat the three step again in the new tab. Hopefully I worded that well enough to be understood.

Version & Environment

Rev: [ed035eea]
OS: [Ubuntu Server 18.04.5 LTS]
Browser: Tested in Firefox 78ESR and Chromium 85

Steps to reproduce

  1. Open a new tab or browser window
  2. Log In
  3. Data Sources and Settings are not loaded
  4. Log out
  5. Log in
  6. Data sources and Settings are loaded like expected.
Originally created by @kk6mrp on GitHub (Sep 18, 2020). Original GitHub issue: https://github.com/cypht-org/cypht/issues/432 Originally assigned to: @jasonmunro on GitHub. ## 🐛 Bugreport Likely there is something I am doing wrong here but I can't seem to find the issue. When opening Cypht in a new tab or browser window at the first login it loads the main Cypht page however it says, "You don't have any data sources assigned to this page." and my user settings are not loaded. After logging out and logging back in, I see data sources and settings loaded like normal. Here is the log files for after the first login: ``` [Fri Sep 18 03:04:03.597207 2020] [php7:notice] [pid 16527] [client 127.0.0.1:46828] Array\n(\n [0] => Using Hm_DB_Session with Hm_Auth_DB\n [1] => Using DB user configuration\n [2] => Using sapi: apache2handler\n [3] => Request type: HTTP\n [4] => Request path: /\n [5] => TLS request: 1\n [6] => Mobile request: 0\n [7] => Page ID: home\n [8] => Redis enabled but not supported by PHP\n [9] => Memcached enabled but not supported by PHP\n [10] => CACHE backend using: noop\n [11] => Missing configuration setting for db_user\n [12] => Missing configuration setting for db_pass\n [13] => Connecting to dsn: sqlite:/var/lib/cypht/app_data/cypht.db\n [14] => Setting cookie: name: hm_id, lifetime: 0, path: /, domain: mail.domain.com, secure: 1, html_only 1\n [15] => Missing configuration setting for db_user\n [16] => Missing configuration setting for db_pass\n [17] => Setting cookie: name: hm_session, lifetime: 0, path: /, domain: mail.domain.com, secure: 1, html_only 1\n [18] => LOGGED IN\n [19] => Missing configuration setting for db_user\n [20] => Missing configuration setting for db_pass\n [21] => Redirecting to ?page=message_list&list_path=combined_inbox\n [22] => PHP version 7.2.24-0ubuntu0.18.04.6\n [23] => Zend version 3.2.0\n [24] => Peak Memory: 6144\n [25] => PID: 16527\n [26] => Included files: 72\n)\n, referer: https://mail.domain.com/ [Fri Sep 18 03:04:03.909934 2020] [php7:notice] [pid 16527] [client 127.0.0.1:46828] Array\n(\n [0] => Using Hm_DB_Session with Hm_Auth_DB\n [1] => Using DB user configuration\n [2] => Using sapi: apache2handler\n [3] => Request type: HTTP\n [4] => Request path: /\n [5] => TLS request: 1\n [6] => Mobile request: 0\n [7] => Page ID: message_list\n [8] => Redis enabled but not supported by PHP\n [9] => Memcached enabled but not supported by PHP\n [10] => CACHE backend using: noop\n [11] => Missing configuration setting for db_user\n [12] => Missing configuration setting for db_pass\n [13] => Connecting to dsn: sqlite:/var/lib/cypht/app_data/cypht.db\n [14] => LOGGED IN\n [15] => CACHE: miss for "feed_read_uids" using noop\n [16] => TYPE CONVERSION: boolean to string for username\n [17] => TRANSLATION NOT FOUND :Date:\n [18] => PHP version 7.2.24-0ubuntu0.18.04.6\n [19] => Zend version 3.2.0\n [20] => Peak Memory: 2048\n [21] => PID: 16527\n [22] => Included files: 74\n)\n, referer: https://mail.domain.com/ [Fri Sep 18 03:04:04.307549 2020] [php7:notice] [pid 16527] [client 127.0.0.1:46828] Array\n(\n [0] => Using Hm_DB_Session with Hm_Auth_DB\n [1] => Using DB user configuration\n [2] => Using sapi: apache2handler\n [3] => Request type: AJAX\n [4] => Request path: /\n [5] => TLS request: 1\n [6] => Mobile request: 0\n [7] => Page ID: ajax_hm_folders\n [8] => Redis enabled but not supported by PHP\n [9] => Memcached enabled but not supported by PHP\n [10] => CACHE backend using: noop\n [11] => Missing configuration setting for db_user\n [12] => Missing configuration setting for db_pass\n [13] => Connecting to dsn: sqlite:/var/lib/cypht/app_data/cypht.db\n [14] => LOGGED IN\n [15] => CACHE: miss for "feed_read_uids" using noop\n [16] => TRANSLATION NOT FOUND :Hide folders:\n [17] => PHP version 7.2.24-0ubuntu0.18.04.6\n [18] => Zend version 3.2.0\n [19] => Peak Memory: 4096\n [20] => PID: 16527\n [21] => Included files: 82\n)\n ``` I did notice after the first login there are two cookies, hm_id and hm_session. After logging out I see four cookies, hm_id, hm_msgs, hm_reload_folders, and hm_session. After logging in again there are two cookies, hm_id and hm_session. If I have logged out and logged back in I can open more new tabs and load Cypht. If I have logged in and back out and then open a new tab to log in the third time, I have to repeat the three step again in the new tab. Hopefully I worded that well enough to be understood. ### Version & Environment Rev: [ed035eea] OS: [Ubuntu Server 18.04.5 LTS] Browser: Tested in Firefox 78ESR and Chromium 85 ### Steps to reproduce 1. Open a new tab or browser window 2. Log In 3. Data Sources and Settings are not loaded 4. Log out 5. Log in 6. Data sources and Settings are loaded like expected.
kerem 2026-02-25 21:34:50 +03:00
  • closed this issue
  • added the
    bug
    core
    labels
Author
Owner

@jasonmunro commented on GitHub (Sep 18, 2020):

When opening Cypht in a new tab or browser window at the first login

I don't understand exactly. This only happens if you have a browser open and open a new tab/window to login to Cypht? Or does it happen anytime you try to login?

<!-- gh-comment-id:694995255 --> @jasonmunro commented on GitHub (Sep 18, 2020): > When opening Cypht in a new tab or browser window at the first login I don't understand exactly. This only happens if you have a browser open and open a new tab/window to login to Cypht? Or does it happen anytime you try to login?
Author
Owner

@kk6mrp commented on GitHub (Sep 18, 2020):

I'm sorry about the confusing description, this happens any time I try to log in.

<!-- gh-comment-id:695003455 --> @kk6mrp commented on GitHub (Sep 18, 2020): I'm sorry about the confusing description, this happens any time I try to log in.
Author
Owner

@kk6mrp commented on GitHub (Jan 19, 2021):

@jasonmunro Do you have any suggestions for how to find the issue here or where to look? Logging out and back in to properly log in is a little frustrating.

<!-- gh-comment-id:763022175 --> @kk6mrp commented on GitHub (Jan 19, 2021): @jasonmunro Do you have any suggestions for how to find the issue here or where to look? Logging out and back in to properly log in is a little frustrating.
Author
Owner

@jasonmunro commented on GitHub (Jan 20, 2021):

@kk6mrp Sorry, I'm at a bit of a loss about how this could be happening. Here is what I would try to eliminate some possible causes:

  • Pull the latest master branch. Don't think this will resolve anything but makes it easier to troubleshoot
  • Change session handling from DB to PHP. We load user config values into the session on login and reference them from there during the login session, so maybe something here is going wrong
  • Change user configuration from DB to files. This is a bit of a pain as you won't have your configured servers but as a test it might be worth trying.

Don't forget when you change your hm3.ini file you need to rerun the config_gen.php script. If you can try those things and let me know if anything works it would help move this forward. Thanks!

<!-- gh-comment-id:763812798 --> @jasonmunro commented on GitHub (Jan 20, 2021): @kk6mrp Sorry, I'm at a bit of a loss about how this could be happening. Here is what I would try to eliminate some possible causes: - Pull the latest master branch. Don't think this will resolve anything but makes it easier to troubleshoot - Change session handling from DB to PHP. We load user config values into the session on login and reference them from there during the login session, so maybe something here is going wrong - Change user configuration from DB to files. This is a bit of a pain as you won't have your configured servers but as a test it might be worth trying. Don't forget when you change your hm3.ini file you need to rerun the config_gen.php script. If you can try those things and let me know if anything works it would help move this forward. Thanks!
Author
Owner

@kk6mrp commented on GitHub (Jan 20, 2021):

So this is on the latest master branch:

  • Changing session handling from DB to PHP still requires me to log in twice. This time however it stays on the login screen. When I log in the first time the URL redirects to /?page=message_list&list_path=combined_inbox but the page stays at the log in screen. Logging in once more opens Cypht and it does load data sources.
  • Changing user configuration from DB to files has no effect on the issue.
<!-- gh-comment-id:763952489 --> @kk6mrp commented on GitHub (Jan 20, 2021): So this is on the latest master branch: - Changing session handling from DB to PHP still requires me to log in twice. This time however it stays on the login screen. When I log in the first time the URL redirects to /?page=message_list&list_path=combined_inbox but the page stays at the log in screen. Logging in once more opens Cypht and it does load data sources. - Changing user configuration from DB to files has no effect on the issue.
Author
Owner

@kk6mrp commented on GitHub (Jan 27, 2021):

@jasonmunro I also found that changing session handling from DB to PHP does not retain my session if I click "Stay Logged In"

Do you think this could have anything to do with me using SQLite?

<!-- gh-comment-id:768610155 --> @kk6mrp commented on GitHub (Jan 27, 2021): @jasonmunro I also found that changing session handling from DB to PHP does not retain my session if I click "Stay Logged In" Do you think this could have anything to do with me using SQLite?
Author
Owner

@kk6mrp commented on GitHub (Jun 8, 2021):

I've reinstalled Cypht on a new server and cannot reproduce this issue, feel free to reopen if needed!

<!-- gh-comment-id:856383840 --> @kk6mrp commented on GitHub (Jun 8, 2021): I've reinstalled Cypht on a new server and cannot reproduce this issue, feel free to reopen if needed!
Author
Owner

@kk6mrp commented on GitHub (Jun 12, 2021):

This issue came back after I set the "First page after login" in the Site Settings and realized that it stems from the change you made for me on github.com/jasonmunro/cypht@ad8b3993cc I didn't notice the correlation at the time but now I see it.

I'm not sure if it is the idle timer interfering with the Hm_Dispatch::page_redirect as discovered here https://github.com/jasonmunro/cypht/issues/273#issuecomment-398881553 or if the Hm_Dispatch::page_redirect is being called at an unexpected time.

Pull request #492 should safely close this issue.

<!-- gh-comment-id:860076201 --> @kk6mrp commented on GitHub (Jun 12, 2021): This issue came back after I set the "First page after login" in the Site Settings and realized that it stems from the change you made for me on https://github.com/jasonmunro/cypht/commit/ad8b3993cc34b02de7e81ae61b4b80f712bc00ae I didn't notice the correlation at the time but now I see it. I'm not sure if it is the idle timer interfering with the `Hm_Dispatch::page_redirect` as discovered here https://github.com/jasonmunro/cypht/issues/273#issuecomment-398881553 or if the `Hm_Dispatch::page_redirect` is being called at an unexpected time. Pull request #492 should safely close this issue.
Author
Owner

@jasonmunro commented on GitHub (Jun 12, 2021):

Thanks for this and great catch. Merging into master + 1.3.0 in just a minute

<!-- gh-comment-id:860084799 --> @jasonmunro commented on GitHub (Jun 12, 2021): Thanks for this and great catch. Merging into master + 1.3.0 in just a minute
Author
Owner

@kk6mrp commented on GitHub (Jun 12, 2021):

Do you know what the root cause is?

<!-- gh-comment-id:860086920 --> @kk6mrp commented on GitHub (Jun 12, 2021): Do you know what the root cause is?
Author
Owner

@jasonmunro commented on GitHub (Jun 12, 2021):

I believe the issue is that it is redirecting before the session is saved, so you don't stay logged in. When you login the second time you are already at the correct url so no redirect happens and you don't get logged out. Regardless this change is the "right" way to do redirects from this context so it is better regardless.

<!-- gh-comment-id:860090183 --> @jasonmunro commented on GitHub (Jun 12, 2021): I believe the issue is that it is redirecting before the session is saved, so you don't stay logged in. When you login the second time you are already at the correct url so no redirect happens and you don't get logged out. Regardless this change is the "right" way to do redirects from this context so it is better regardless.
Author
Owner

@kk6mrp commented on GitHub (Jun 12, 2021):

Ok, I'm not very familiar with the codebase yet but that makes sense... Thanks!

<!-- gh-comment-id:860090552 --> @kk6mrp commented on GitHub (Jun 12, 2021): Ok, I'm not very familiar with the codebase yet but that makes sense... Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#358
No description provided.