[GH-ISSUE #1556] 🐛 [Bug] Cannot login when SESSION_TYPE=REDIS #684

Closed
opened 2026-02-25 21:35:40 +03:00 by kerem · 5 comments
Owner

Originally created by @diogovalentte on GitHub (Jun 21, 2025).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/1556

Originally assigned to: @IrAlfred on GitHub.

🐛 Bug

When I set SESSION_TYPE to REDIS and try to login, it says that my credentials are wrong. Setting it to DB works, but it seems cypht doesn't use redis for caching.

I tested and the cypht container can connect to the redis container.

Version & Environment

Using docker compose:

services:
  db:
    container_name: cypht-db
    image: mariadb:10
    volumes:
      - /Apps/cypht/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=root_password
      - MYSQL_DATABASE=cypht
      - MYSQL_USER=cypht
      - MYSQL_PASSWORD=cypht_password
    restart: unless-stopped

  redis:
    container_name: cypht-redis
    image: redis:7-alpine
    volumes:
      - /Apps/cypht/redis/data:/data
    restart: unless-stopped

  cypht:
    container_name: cypht
    image: cypht/cypht:2.4.0
    volumes:
      - /Apps/cypht/users:/var/lib/hm3/users
    ports:
      - 46185:80
    environment:
      - DEBUG_LOG=true
      - AUTH_USERNAME=${AUTH_USERNAME}
      - AUTH_PASSWORD=${AUTH_PASSWORD}
      - DB_CONNECTION_TYPE=host
      - DB_DRIVER=mysql
      - DB_HOST=db
      - DB_NAME=cypht
      - DB_USER=cypht
      - DB_PASS=cypht_password
      - DB_SOCKET=/var/lib/mysqld/mysqld.sock
      - USER_CONFIG_TYPE=DB
      - SESSION_TYPE=REDIS
      - AUTH_TYPE=DB
      - ENABLE_REDIS=true
      - REDIS_SERVER=redis
      - REDIS_PORT=6379
      - REDIS_INDEX=1
      - REDIS_SOCKET=
      - GMAIL_CLIENT_ID=${GMAIL_CLIENT_ID}
      - GMAIL_CLIENT_SECRET=${GMAIL_CLIENT_SECRET}
      - GMAIL_CLIENT_URI=${GMAIL_CLIENT_URI}
    restart: unless-stopped

Logs

Attempting to connect to database ... (1/10)

Attempting to connect to database ... (2/10)

Database connection successful ...

Creating database table hm_user ...

CREATE TABLE IF NOT EXISTS hm_user (username varchar(255), hash varchar(255), primary key (username));

Creating database table hm_user_settings ...

Db setup finished

Creating directory for attachments /var/lib/hm3/attachments

user <redacted> already exists

scanning module core ...

scanning module contacts ...

scanning module local_contacts ...

scanning module ldap_contacts ...

scanning module gmail_contacts ...

scanning module feeds ...

scanning module jmap ...

scanning module imap ...

scanning module smtp ...

scanning module account ...

scanning module idle_timer ...

scanning module desktop_notifications ...

scanning module calendar ...

scanning module themes ...

scanning module nux ...

scanning module developer ...

scanning module profiles ...

scanning module imap_folders ...

scanning module sievefilters ...

site.css file created

site.js file created

dynamic.php file written

creating production site

2025-06-21 21:22:03,319 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.

2025-06-21 21:22:03,323 INFO supervisord started with pid 19

2025-06-21 21:22:04,325 INFO spawned: 'nginx' with pid 20

2025-06-21 21:22:04,326 INFO spawned: 'php-fpm' with pid 21

[21-Jun-2025 21:22:04] NOTICE: fpm is running, pid 21

[21-Jun-2025 21:22:04] NOTICE: ready to handle connections

2025-06-21 21:22:05,408 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

2025-06-21 21:22:05,408 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs
Originally created by @diogovalentte on GitHub (Jun 21, 2025). Original GitHub issue: https://github.com/cypht-org/cypht/issues/1556 Originally assigned to: @IrAlfred on GitHub. ## 🐛 Bug When I set `SESSION_TYPE` to `REDIS` and try to login, it says that my credentials are wrong. Setting it to `DB` works, but it seems cypht doesn't use redis for caching. I tested and the cypht container can connect to the redis container. ### Version & Environment Using docker compose: ```yml services: db: container_name: cypht-db image: mariadb:10 volumes: - /Apps/cypht/db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=root_password - MYSQL_DATABASE=cypht - MYSQL_USER=cypht - MYSQL_PASSWORD=cypht_password restart: unless-stopped redis: container_name: cypht-redis image: redis:7-alpine volumes: - /Apps/cypht/redis/data:/data restart: unless-stopped cypht: container_name: cypht image: cypht/cypht:2.4.0 volumes: - /Apps/cypht/users:/var/lib/hm3/users ports: - 46185:80 environment: - DEBUG_LOG=true - AUTH_USERNAME=${AUTH_USERNAME} - AUTH_PASSWORD=${AUTH_PASSWORD} - DB_CONNECTION_TYPE=host - DB_DRIVER=mysql - DB_HOST=db - DB_NAME=cypht - DB_USER=cypht - DB_PASS=cypht_password - DB_SOCKET=/var/lib/mysqld/mysqld.sock - USER_CONFIG_TYPE=DB - SESSION_TYPE=REDIS - AUTH_TYPE=DB - ENABLE_REDIS=true - REDIS_SERVER=redis - REDIS_PORT=6379 - REDIS_INDEX=1 - REDIS_SOCKET= - GMAIL_CLIENT_ID=${GMAIL_CLIENT_ID} - GMAIL_CLIENT_SECRET=${GMAIL_CLIENT_SECRET} - GMAIL_CLIENT_URI=${GMAIL_CLIENT_URI} restart: unless-stopped ``` ### Logs ``` Attempting to connect to database ... (1/10) Attempting to connect to database ... (2/10) Database connection successful ... Creating database table hm_user ... CREATE TABLE IF NOT EXISTS hm_user (username varchar(255), hash varchar(255), primary key (username)); Creating database table hm_user_settings ... Db setup finished Creating directory for attachments /var/lib/hm3/attachments user <redacted> already exists scanning module core ... scanning module contacts ... scanning module local_contacts ... scanning module ldap_contacts ... scanning module gmail_contacts ... scanning module feeds ... scanning module jmap ... scanning module imap ... scanning module smtp ... scanning module account ... scanning module idle_timer ... scanning module desktop_notifications ... scanning module calendar ... scanning module themes ... scanning module nux ... scanning module developer ... scanning module profiles ... scanning module imap_folders ... scanning module sievefilters ... site.css file created site.js file created dynamic.php file written creating production site 2025-06-21 21:22:03,319 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. 2025-06-21 21:22:03,323 INFO supervisord started with pid 19 2025-06-21 21:22:04,325 INFO spawned: 'nginx' with pid 20 2025-06-21 21:22:04,326 INFO spawned: 'php-fpm' with pid 21 [21-Jun-2025 21:22:04] NOTICE: fpm is running, pid 21 [21-Jun-2025 21:22:04] NOTICE: ready to handle connections 2025-06-21 21:22:05,408 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2025-06-21 21:22:05,408 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs ```
kerem 2026-02-25 21:35:40 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@IrAlfred commented on GitHub (Jul 1, 2025):

Hello @diogovalentte

It seems the issue you are facing is related to Cypht's case-sensitive configuration handling. Try to use lowercase value in your SESSION_TYPE environment variable:

- SESSION_TYPE=redis

Instead of

- SESSION_TYPE=REDIS

Looking forward to your feedback when you have a moment to review this. Thanks !

<!-- gh-comment-id:3023690272 --> @IrAlfred commented on GitHub (Jul 1, 2025): Hello @diogovalentte It seems the issue you are facing is related to Cypht's case-sensitive configuration handling. Try to use lowercase value in your SESSION_TYPE environment variable: ``` - SESSION_TYPE=redis ``` Instead of ``` - SESSION_TYPE=REDIS ``` Looking forward to your feedback when you have a moment to review this. Thanks !
Author
Owner

@diogovalentte commented on GitHub (Jul 1, 2025):

Using low case "redis" worked, and I can log in and use the app, but it seems cypht still doesn't use redis for caching.

Checking redis stats it has 0 misses and hits, and looking at the command logs, it only shows pings:

1751386851.001687 [0 172.32.0.1:60460] "info" "all"
1751386851.002982 [0 172.32.0.1:60460] "ping"
1751386851.003799 [0 172.32.0.1:60460] "ping"
1751386851.004172 [0 172.32.0.1:60460] "ping"
1751386851.004551 [0 172.32.0.1:60460] "ping"
1751386851.004860 [0 172.32.0.1:60460] "ping"
1751386852.001623 [0 172.32.0.1:60460] "info" "all"
1751386852.003059 [0 172.32.0.1:60460] "ping"
1751386852.004836 [0 172.32.0.1:60460] "ping"
1751386852.005444 [0 172.32.0.1:60460] "ping"
1751386852.005904 [0 172.32.0.1:60460] "ping"
1751386852.006318 [0 172.32.0.1:60460] "ping"

How exactly is redis being used? I thought clicking to see an account inbox would be faster with redis, or something like that.

<!-- gh-comment-id:3024719536 --> @diogovalentte commented on GitHub (Jul 1, 2025): Using low case "redis" worked, and I can log in and use the app, but it seems cypht still doesn't use redis for caching. Checking redis stats it has 0 misses and hits, and looking at the command logs, it only shows pings: ``` 1751386851.001687 [0 172.32.0.1:60460] "info" "all" 1751386851.002982 [0 172.32.0.1:60460] "ping" 1751386851.003799 [0 172.32.0.1:60460] "ping" 1751386851.004172 [0 172.32.0.1:60460] "ping" 1751386851.004551 [0 172.32.0.1:60460] "ping" 1751386851.004860 [0 172.32.0.1:60460] "ping" 1751386852.001623 [0 172.32.0.1:60460] "info" "all" 1751386852.003059 [0 172.32.0.1:60460] "ping" 1751386852.004836 [0 172.32.0.1:60460] "ping" 1751386852.005444 [0 172.32.0.1:60460] "ping" 1751386852.005904 [0 172.32.0.1:60460] "ping" 1751386852.006318 [0 172.32.0.1:60460] "ping" ``` How exactly is redis being used? I thought clicking to see an account inbox would be faster with redis, or something like that.
Author
Owner

@IrAlfred commented on GitHub (Aug 23, 2025):

Hello @diogovalentte,

Thank you for your detailed feedback. You are correct in your observation.

Cypht's primary use of Redis is for session storage, not for caching email content. The PING commands confirm the connection is active, managing your login session data.

This implementation ensures reliability and scalability in multi-server environments but does not accelerate email fetching, which remains dependent on your IMAP server. Therefore, you would not see cache hits/misses for email operations.

<!-- gh-comment-id:3216859933 --> @IrAlfred commented on GitHub (Aug 23, 2025): Hello @diogovalentte, Thank you for your detailed feedback. You are correct in your observation. Cypht's primary use of Redis is for session storage, not for caching email content. The PING commands confirm the connection is active, managing your login session data. This implementation ensures reliability and scalability in multi-server environments but does not accelerate email fetching, which remains dependent on your IMAP server. Therefore, you would not see cache hits/misses for email operations.
Author
Owner

@marclaporte commented on GitHub (Aug 25, 2025):

@diogovalentte

You wrote: "I thought clicking to see an account inbox would be faster with redis, or something like that."

The Cypht community has done a lot of work aiming to improve performance, especially on multiple accounts. This will be part of upcoming Cypht 2.5.0: https://github.com/cypht-org/cypht/issues/1624

I look forward to your feedback when it is released.

<!-- gh-comment-id:3218619832 --> @marclaporte commented on GitHub (Aug 25, 2025): @diogovalentte You wrote: "I thought clicking to see an account inbox would be faster with redis, or something like that." The Cypht community has done a lot of work aiming to improve performance, especially on multiple accounts. This will be part of upcoming Cypht 2.5.0: https://github.com/cypht-org/cypht/issues/1624 I look forward to your feedback when it is released.
Author
Owner

@IrAlfred commented on GitHub (Nov 11, 2025):

https://github.com/cypht-org/cypht/wiki/Cypht%E2%80%90Redis-setup

<!-- gh-comment-id:3516635187 --> @IrAlfred commented on GitHub (Nov 11, 2025): [https://github.com/cypht-org/cypht/wiki/Cypht%E2%80%90Redis-setup](https://github.com/cypht-org/cypht/wiki/Cypht%E2%80%90Redis-setup)
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#684
No description provided.