I have two load balanced roundcube EC2 instances running in docker containers with the 1.4.x-apache image from
https://hub.docker.com/r/roundcube/roundcubemail. I'm using a mariadb (mysql) database on a single db server. The instances should be using the db for session storage, and as far as I can tell they are doing so. There are hundreds of rows in the session table from both front end IPs. The load balancer is using a round robin algorithm. Every other request to roundcube is failing, with one of two messages:
- Connection to storage server failed.
- Could not load message from server.
I've been able to eliminate the errors by configuring stickiness (aka persistence) on the load balancer. When a client's requests are handled by a single instance, they are all successful. It does not matter which instance handles the requests as long as they continue going to the same one. Therefore it seems to me like a problem with the session storage/retrieval. But I can't figure out how to troubleshoot this further.
With stickiness removed again I've enabled imap_debug and session_debug and explicitly set session_storage to 'db'. I don't see any IMAP failures logged and HTTP requests are getting 200 responses. I do see some "Session auth check failed" messages, followed by "Send new auth cookie" messages, but according to
https://github.com/roundcube/roundcubemail/issues/8024, these are normal. Those log messages do not occur at the same time that I get errors in the browser, or nearly as frequently. It seems like when I get the browser error "Could not load message from server", only an HTTP request is logged but no IMAP request/response.
Any idea what else I should check? These are my non-default roundcube configs, with private info redacted in caps:
config.inc.php
<?php
$config['plugins'] = [];
$config['log_driver'] = 'stdout';
$config['zipdownload_selection'] = true;
$config['des_key'] = 'MYDESKEY';
include(__DIR__ . '/config.docker.inc.php');
config.docker.inc.php
<?php
$config['db_dsnw'] = 'mysql://roundcube:MYDBPASSWORD@10.10.10.10:3306/roundcubemail';
$config['db_dsnr'] = '';
$config['default_host'] = 'ssl://imapserver.mydomain.com';
$config['default_port'] = '993';
$config['smtp_server'] = 'ssl://smtpserver.mydomain.com';
$config['smtp_port'] = '465';
$config['temp_dir'] = '/tmp/roundcube-temp';
$config['skin'] = 'larry';
$config['plugins'] = array_filter(array_unique(array_merge($config['plugins'], ['archive', 'zipdownload', 'database_attachments'])));
include('/var/roundcube/config/config.imap_debug.php');
include('/var/roundcube/config/config.session_debug.php');
include('/var/roundcube/config/config.session_storage.php');
config.imap_debug.php
<?php
$config['imap_debug'] = true;
config.session_debug.php
<?php
$config['session_debug'] = true;
config.session_storage.php
<?php
$config['session_storage'] = 'db';