Mailroom fails with Net::OpenTimeout

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Mailroom repeatedly fails with Net::OpenTimeout on a fresh GitLab deployment using Docker.

I am able to connect to the IMAP server from another container on the same machine in < 30 seconds (the default timeout).

Steps to reproduce

The relevant configuration section (I used GITLAB_OMNIBUS_CONFIG in the compose file):

gitlab_rails['incoming_email_enabled'] = true
gitlab_rails['incoming_email_host'] = 'imap.gmx.com'
gitlab_rails['incoming_email_port'] = 993
gitlab_rails['incoming_email_ssl'] = true
gitlab_rails['incoming_email_start_tls'] = false
gitlab_rails['incoming_email_address'] = '%{key}@git.[REDACTED]'
gitlab_rails['incoming_email_email'] = '[REDACTED]@gmx.com'
gitlab_rails['incoming_email_password'] = '[REDACTED]'
gitlab_rails['incoming_email_mailbox_name'] = 'Inbox'
gitlab_rails['incoming_email_delete_after_delivery'] = true
gitlab_rails['incoming_email_expunge_deleted'] = true
gitlab_rails['incoming_email_idle_timeout'] = 60

After fully configuring and starting the instance, I have created a project and obtained an e-mail address for submitting issues.

I have sent a simple e-mail to the address provided.

For sanity, I have deployed a mail client in another Docker container on the same machine to validate the forwarding setup and the IMAP configuration; the host imap.gmx.com is reachable, connects, and the credentials are correct; I can view the e-mail I sent in the inbox in ~15-20 seconds.

What is the current bug behavior?

Incoming mail is not processed and the logs indicate a recurring Net::OpenTimeout error.

What is the expected correct behavior?

Incoming mail should be processed and an issue should be created in the intended project.

Relevant logs and/or screenshots

==> mailroom/mail_room_json.log <==
{"severity":"INFO","time":"2025-11-17T00:03:47.697+00:00","context":{"email":"[REDACTED]@gmx.com","name":"Inbox"},"action":"Setting up watcher"}
{"severity":"INFO","time":"2025-11-17T00:03:47.698+00:00","context":{"email":"[REDACTED]@gmx.com","name":"Inbox"},"action":"Starting TLS session"}
{"severity":"INFO","time":"2025-11-17T00:03:47.698+00:00","context":{"email":"[REDACTED]@gmx.com","name":"Inbox"},"action":"Logging into mailbox"}
==> /var/log/gitlab/mailroom/current <==
2025-11-17_00:04:17.76614 /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-protocol-0.2.2/lib/net/protocol.rb:43:in `ssl_socket_connect': Net::OpenTimeout (Net::Open)
2025-11-17_00:04:17.76616       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-imap-0.5.9/lib/net/imap.rb:3789:in `start_tls_session'
2025-11-17_00:04:17.76616       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-imap-0.5.9/lib/net/imap.rb:1123:in `initialize'
2025-11-17_00:04:17.76617       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-imap-0.5.9/lib/net/imap/deprecated_client_options.rb:74:in `initialize'
2025-11-17_00:04:17.76617       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/imap/connection.rb:77:in `new'
2025-11-17_00:04:17.76619       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/imap/connection.rb:77:in `imap'
2025-11-17_00:04:17.76619       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/imap/connection.rb:87:in `log_in'
2025-11-17_00:04:17.76619       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/imap/connection.rb:69:in `setup'
2025-11-17_00:04:17.76619       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/imap/connection.rb:11:in `initialize'
2025-11-17_00:04:17.76620       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/mailbox_watcher.rb:71:in `new'
2025-11-17_00:04:17.76621       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/mailbox_watcher.rb:71:in `connection'
2025-11-17_00:04:17.76621       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/mailbox_watcher.rb:31:in `run'
2025-11-17_00:04:17.76621       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/coordinator.rb:22:in `each'
2025-11-17_00:04:17.76622       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/coordinator.rb:22:in `run'
2025-11-17_00:04:17.76622       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/lib/mail_room/cli.rb:58:in `start'
2025-11-17_00:04:17.76622       from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/gitlab-mail_room-0.0.27/bin/mail_room:5:in `<top (required)>'
2025-11-17_00:04:17.76623       from /opt/gitlab/embedded/lib/ruby/site_ruby/3.2.0/rubygems.rb:319:in `load'
2025-11-17_00:04:17.76623       from /opt/gitlab/embedded/lib/ruby/site_ruby/3.2.0/rubygems.rb:319:in `activate_and_load_bin_path'
2025-11-17_00:04:17.76624       from /opt/gitlab/embedded/bin/mail_room:25:in `<main>'

Output of checks

Results of GitLab environment info

System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   3.2.8
Gem Version:    3.7.1
Bundler Version:2.7.1
Rake Version:   13.0.6
Redis Version:  7.2.11
Sidekiq Version:7.3.9
Go Version:     unknown

GitLab information
Version:        18.5.2-ee
Revision:       cb961538ba8
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     16.10
URL:            https://git.[REDACTED]
HTTP Clone URL: https://git.[REDACTED]/some-group/some-project.git
SSH Clone URL:  git@git.[REDACTED]:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: openid_connect

GitLab Shell
Version:        14.45.3
Repository storages:
- default:      unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address:      unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version:      18.5.2
- default Git Version:  2.50.1

Results of GitLab application Check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.45.3 ? ... OK (14.45.3)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell-check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Checking Reply by email ...

IMAP server credentials are correct? ... Checking [REDACTED]@gmx.com
no
  Try fixing it:
  An error occurred: Net::OpenTimeout: Net::OpenTimeout
  Check that the information in config/gitlab.yml is correct
  For more information see:
  doc/administration/reply_by_email.md
  Please fix the error above and rerun the checks.
Mailroom enabled? ... skipped
MailRoom running? ... skipped

Checking Reply by email ... Finished


Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes
Tables are truncated? ... skipped
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Cable config exists? ... yes
Resque config exists? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Projects have namespace: ...
4/1 ... yes
Redis version >= 6.2.14? ... yes
Ruby version >= 3.0.6 ? ... yes (3.2.8)
Git user has default SSH configuration? ... yes
Active users: ... 1
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Elasticsearch version 7.x-9.x or OpenSearch version 1.x-3.x ... skipped (advanced search is disabled)
All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled)

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

Possible fixes

Increasing open_timeout may be an option, assuming that is indeed the cause.

Edited by 🤖 GitLab Bot 🤖