View Issue Details

IDProjectCategoryView StatusLast Update
0006244SOGowith SOGopublic2026-09-03 18:53
Reporternordlead Assigned Toqhivert  
PriorityurgentSeverityblockReproducibilityalways
Status assignedResolutionopen 
Product Version5.12.10 
Summary0006244: Possible SQL connection leak/regression in SOGo/SOPE 5.12.10
Description

Summary

After upgrading SOGo and SOPE from version 5.12.9 to 5.12.10, idle MariaDB connections opened by sogod progressively accumulate.

The connection count does not appear to return to a small stable pool. It can eventually reach MariaDB's max_connections limit, after which SOGo starts returning HTTP 501 responses for multiple CalDAV and CardDAV requests and becomes unavailable.

Using the same configuration, database, workload and number of workers, downgrading SOGo and SOPE to 5.12.9 restores the previous behaviour: unused SQL connections are released and the number of connections remains stable.

All customer names, domains, addresses, credentials and public IP addresses have been replaced or omitted from this report.

Environment

  • Affected SOGo version: 5.12.10
  • Affected SOPE version: 5.12.10
  • Comparison SOGo version: 5.12.9
  • Comparison SOPE version: 5.12.9
  • Installation method: source build from the corresponding official Git tags
  • Container base image: Debian stable-slim
  • Database: MariaDB 12.3.3
  • Reverse proxy: nginx
  • Deployment: Docker Compose
  • Number of SOGo workers: 10
  • Number of mail accounts: approximately 10
  • Client protocols: mainly CalDAV and CardDAV
  • SOGo and MariaDB run in separate containers on the same Docker network

Both versions were tested with the same SOGo configuration, MariaDB configuration, worker count and normal client workload.

Relevant SOGo configuration

Sensitive values have been replaced with placeholders.

WOWorkersCount = 10;
WOWatchDogRequestTimeout = 10;
WOListenQueueSize = 50;

SOGoProfileURL =
  "mysql://sogo:<REDACTED>@mariadb:3306/sogo/sogo_user_profile";

OCSFolderInfoURL =
  "mysql://sogo:<REDACTED>@mariadb:3306/sogo/sogo_folder_info";

OCSSessionsFolderURL =
  "mysql://sogo:<REDACTED>@mariadb:3306/sogo/sogo_sessions_folder";

OCSAdminURL =
  "mysql://sogo:<REDACTED>@mariadb:3306/sogo/sogo_admin";

An additional SQL user source reads account information from a view in another database. Its database name, table/view name, domain and credentials have been omitted.

Relevant MariaDB configuration

The following MariaDB settings were identical during both tests:

max_connections = 300
wait_timeout = 3600
interactive_timeout = 3600

Symptoms with SOGo/SOPE 5.12.10

With version 5.12.10, idle MariaDB connections belonging to the sogo database user progressively increased.

The connections appeared in information_schema.PROCESSLIST as:

USER    DB      COMMAND
sogo    sogo    Sleep

Example measurements:

Time      Idle SOGo connections   Longest current idle time
15:00               15                       535 s
15:01               16                       595 s
15:02               17                       655 s
15:03               18                       715 s
15:05               20                       835 s
15:08               23                      1016 s
15:17               33                      1606 s
15:18               34                      1666 s
15:20               36                      1786 s
15:23               38                      1966 s
15:27               42                      2206 s
15:29               44                      2327 s
15:30               46                      2387 s
15:32               47                      2493 s
15:39               53                      2927 s
15:40               55                      2987 s
15:42               56                      3108 s
15:44               58                      3228 s
15:45               58                      3288 s

The number therefore increased from 15 to 58 idle connections in approximately 45 minutes.

During the measurements, MariaDB showed very little active work:

Threads_running = 1
Connection_errors_max_connections = 0
Max_used_connections = 69

This suggests that the connections were not caused by blocked or long-running queries. Most connections were sleeping.

Production impact

During an earlier occurrence, the progressive accumulation eventually reached MariaDB's connection limit.

MariaDB then logged errors similar to:

Aborted connection 0 to db: 'unconnected'
user: 'unauthenticated'
host: 'connecting host'
(Too many connections)

At the same time:

  • SOGo became inaccessible;
  • CalDAV and CardDAV synchronizations failed;
  • SOGo returned HTTP 501 for multiple users;
  • calendar, calendar inbox and address-book DAV resources were affected;
  • unrelated mail components using the same MariaDB server also experienced connection failures.

The container health check could still report SOGo as healthy because a simple unauthenticated HTTP request continued to receive a response, while authenticated DAV operations failed because no SQL connection was available.

Restarting SOGo or MariaDB temporarily restored service, but the connections began accumulating again with version 5.12.10.

Comparison with SOGo/SOPE 5.12.9

SOGo and SOPE were rebuilt from the 5.12.9 tags.

Only the SOGo container was recreated. MariaDB was not restarted, and its configuration was not changed.

The SOGo container reported:

SOGO_VERSION=5.12.9
RestartCount=0

The process tree contained:

1 sogod master
10 sogod workers

All workers had the same parent process and the same start time. No container or worker restart occurred during the following measurements.

Results with version 5.12.9:

Time      Idle SOGo connections   Longest current idle time
15:46               14                        33 s
15:47               14                        93 s
15:48               14                       153 s
15:49               14                       213 s
15:50               14                       273 s
15:51                6                       323 s
15:52                5                       383 s
15:53                6                       443 s
15:54                5                       503 s
15:55                5                       563 s
15:56                6                       623 s
15:57                6                       683 s
15:58                6                       743 s
15:59                6                       803 s
16:00                5                       863 s
16:01                5                       923 s
16:02                6                       984 s
16:03                6                      1044 s
16:04                6                      1104 s
16:05                5                      1164 s
16:06                6                      1224 s
16:07                5                      1284 s
16:08                9                      1344 s
16:09                9                      1404 s
16:10                9                      1464 s
16:11                8                      1524 s
16:12                8                      1584 s
16:13                7                      1644 s
16:14                8                      1704 s
16:15                8                      1765 s
16:16                7                      1825 s
16:17                7                      1885 s
16:18                6                      1922 s

After an initial reduction from 14 connections, the SOGo connection count remained between approximately five and nine connections for more than 30 minutes under normal activity.

At the end of this observation:

SOGo idle connections = 6
Total application connections = 11
Threads_running = 1
Connection_errors_max_connections = 0
SOGo container restarts = 0

Aborted_clients did not increase during the 5.12.9 observation.

The increase previously seen in Aborted_clients occurred when the 5.12.10 container was deliberately stopped and recreated as 5.12.9. It did not continue after 5.12.9 was started.

Interpretation of MariaDB TIME

For a connection in the Sleep state, the TIME column represents its current idle duration, not its complete lifetime.

Some individual connections remained idle for more than 1,800 seconds with version 5.12.9. This is not itself considered abnormal because the total number of connections remained small and bounded.

The significant difference is the connection-count behaviour:

SOGo/SOPE 5.12.10:
15 to 58 idle connections, with continued growth

SOGo/SOPE 5.12.9:
14 initially, then stable between approximately 5 and 9

The MariaDB wait_timeout was 3600 seconds for both tests.

With 5.12.9, most unused connections were released after approximately five minutes, well before the MariaDB timeout. With 5.12.10, the number continued increasing while older idle connections remained present.

Database monitoring query

The same query was used for both versions:

SELECT
  NOW() AS measurement,
  COUNT(*) AS connections,
  MIN(TIME) AS shortest_idle_time,
  MAX(TIME) AS longest_idle_time,
  SUM(TIME >= 3300) AS near_timeout,
  SUM(TIME >= 3600) AS beyond_timeout
FROM information_schema.PROCESSLIST
WHERE USER = 'sogo'
  AND COMMAND = 'Sleep';

Global MariaDB status was monitored using:

SHOW GLOBAL STATUS
WHERE Variable_name IN (
  'Threads_connected',
  'Threads_running',
  'Max_used_connections',
  'Connection_errors_max_connections',
  'Aborted_clients',
  'Aborted_connects'
);

Expected behaviour

SQL connections opened by a fixed number of sogod workers should be reused or released. The total number of connections should remain bounded under a small and stable workload.

Actual behaviour

With SOGo/SOPE 5.12.10, idle SQL connections progressively accumulate. During a previous occurrence, they contributed to exhaustion of MariaDB's connection limit and caused DAV requests to fail.

With SOGo/SOPE 5.12.9, using the same configuration and ten workers, the SQL connection count quickly decreases and remains bounded at approximately five to nine connections.

Steps to reproduce

  1. Configure SOGo with a MariaDB backend and multiple standard SOGo database URLs.
  2. Configure ten sogod workers.
  3. Start SOGo/SOPE 5.12.10.
  4. Generate normal CalDAV and CardDAV activity from several user accounts.
  5. Monitor sleeping connections for the sogo MariaDB user.
  6. Observe that the number of idle connections progressively increases.
  7. Rebuild SOGo and SOPE from the 5.12.9 tags without changing the configuration.
  8. Recreate only the SOGo container.
  9. Repeat the same monitoring under normal client activity.
  10. Observe that the number of idle SOGo connections decreases and remains bounded.

Possible affected component

The issue may be related to SQL channel retention, reuse or cleanup in SOGo/SOPE 5.12.10, possibly in the GCS channel manager or MySQL/MariaDB channel implementation.

Questions

Could you please confirm:

  1. Whether SQL channel management changed between SOGo/SOPE 5.12.9 and 5.12.10?
  2. Whether there is a known regression affecting MySQL/MariaDB connection cleanup?
  3. Whether a new configuration option is required in version 5.12.10?
  4. Whether additional debug logging can be enabled specifically for GCS or SQL channel allocation and release?

Complete sanitized configuration files, longer monitoring data and debug logs can be provided if required.

TagsNo tags attached.

Activities

qhivert

qhivert

2026-09-03 11:55

administrator   ~0018537

Hello, thanks for reporting.

I think it comes from this commit -> https://github.com/Alinto/sogo/commit/78807d01aee9195b95e2ed21344f260aadb2faef
Where I instantiate several new "channel" object to the database. I will look into it.

nordlead

nordlead

2026-09-03 11:59

reporter   ~0018538

Thank you for your feedback; I hope this helps.

qhivert

qhivert

2026-09-03 15:13

administrator   ~0018540

I don't manage to reproduce the problem (even with caldav requests). However I've made a potential fix here -> https://github.com/Alinto/sogo/commit/152f44b90e08013b5c132473a2de249682d997df

Would you be able to test the next nightly with it?

nordlead

nordlead

2026-09-03 18:53

reporter   ~0018541

I applied the patch you released.
I've been using it for two hours; the results seem stable, but there are a lot of sessions relative to the number of users—especially considering that the company where SOGo is installed is currently closed.
So, I don't think the issue is resolved.
Summary

SOGo/SOPE 5.12.10 showed a progressive accumulation of idle MariaDB connections.

Under normal CalDAV and CardDAV activity, the number of sleeping connections opened by the sogo database user increased continuously. During an earlier incident, this eventually exhausted MariaDB's max_connections limit, causing SOGo DAV requests to return HTTP 501 responses and making the service unavailable.

SOGo/SOPE 5.12.9 did not show this behaviour: the number of connections remained between approximately five and nine.

I have now tested SOGo 5.12.10 with the following official fix applied:

https://github.com/Alinto/sogo/commit/152f44b90e08013b5c132473a2de249682d997df

The patch prevents the previously observed continuous growth. With the patched 5.12.10 build, the connection count remains bounded at approximately 32–33 connections.

The patched build therefore fixes the main connection exhaustion issue, although its steady-state connection count remains higher than with version 5.12.9.

All customer names, domains, IP addresses, account names and credentials have been removed or replaced with generic placeholders.

Environment

  • Deployment: Docker Compose
  • Container base image: Debian stable-slim
  • Database: MariaDB 12.3.3
  • Reverse proxy: nginx
  • Client protocols: mainly CalDAV and CardDAV
  • Approximate number of mail accounts: 10
  • SOGo workers: 10
  • SOGo and MariaDB run in separate containers
  • SOGo and SOPE are compiled from the corresponding official Git tags

Versions compared

  1. SOGo/SOPE 5.12.10 without the fix
  2. SOGo/SOPE 5.12.9
  3. SOGo/SOPE 5.12.10 with commit:
152f44b90e08013b5c132473a2de249682d997df

Relevant SOGo configuration

WOWorkersCount = 10;
WOWatchDogRequestTimeout = 10;
WOListenQueueSize = 50;

The standard SOGo SQL URLs are configured:

SOGoProfileURL
OCSFolderInfoURL
OCSSessionsFolderURL
OCSAdminURL

An additional SQL user source is used for authentication and address-book information. All SQL credentials and customer-specific database information have been omitted.

Relevant MariaDB configuration

The MariaDB settings remained identical during the comparison:

max_connections = 300
wait_timeout = 3600
interactive_timeout = 3600

Original behaviour with unpatched 5.12.10

With SOGo/SOPE 5.12.10, idle connections belonging to the sogo database user progressively accumulated.

The connections appeared in MariaDB as:

USER    DB      COMMAND
sogo    sogo    Sleep

Observed progression:

Time      Idle SOGo connections   Longest idle time
15:00               15                       535 s
15:01               16                       595 s
15:02               17                       655 s
15:03               18                       715 s
15:05               20                       835 s
15:08               23                      1016 s
15:17               33                      1606 s
15:18               34                      1666 s
15:20               36                      1786 s
15:23               38                      1966 s
15:27               42                      2206 s
15:29               44                      2327 s
15:30               46                      2387 s
15:32               47                      2493 s
15:39               53                      2927 s
15:40               55                      2987 s
15:42               56                      3108 s
15:44               58                      3228 s
15:45               58                      3288 s

The count increased from 15 to 58 idle connections in approximately 45 minutes and had not reached a stable application-controlled limit.

During a previous occurrence, MariaDB eventually reported:

Aborted connection 0 to db: 'unconnected'
user: 'unauthenticated'
host: 'connecting host'
(Too many connections)

At the same time:

  • SOGo became inaccessible;
  • multiple CalDAV and CardDAV synchronizations failed;
  • HTTP 501 responses were returned for unrelated users and DAV resources;
  • other mail services sharing MariaDB were affected by the exhausted connection limit.

Comparison with SOGo/SOPE 5.12.9

SOGo and SOPE were rebuilt from the 5.12.9 tags without changing the worker count or MariaDB settings.

The container did not restart during the test:

RestartCount = 0

The process tree remained unchanged:

1 sogod master
10 sogod workers

Observed results:

Time      Idle SOGo connections   Longest idle time
15:46               14                        33 s
15:47               14                        93 s
15:48               14                       153 s
15:49               14                       213 s
15:50               14                       273 s
15:51                6                       323 s
15:52                5                       383 s
15:53                6                       443 s
15:54                5                       503 s
15:55                5                       563 s
15:56                6                       623 s
15:57                6                       683 s
15:58                6                       743 s
15:59                6                       803 s
16:00                5                       863 s
16:05                5                      1164 s
16:10                9                      1464 s
16:15                8                      1765 s
16:18                6                      1922 s

The connection count stabilized between approximately five and nine.

This reduction was not caused by MariaDB's wait_timeout, because it occurred after approximately five minutes while wait_timeout remained set to 3600 seconds.

Patched SOGo/SOPE 5.12.10

SOGo 5.12.10 was rebuilt with the official patch applied on top of the 5.12.10 tag:

Commit: 152f44b90e08013b5c132473a2de249682d997df
Subject: fix(db): release db channel after using them

The patch adds missing releaseChannel: calls in:

SOPE/GDLContentStore/GCSFolderManager.m

The running image reported:

Version = 5.12.10
Patch = 152f44b90e08013b5c132473a2de249682d997df
Status = running
Health = healthy
RestartCount = 0
Command = /entrypoint.sh

Container start time:

2026-09-03 18:29:24 local time

The process tree remained unchanged:

1 sogod master
10 sogod workers

All workers had the same parent PID and the same start time.

Patched 5.12.10 results

After more than 90 minutes of container uptime, the following connection counts were observed:

Time      Idle SOGo connections   Longest idle time
20:01               33                      3555 s
20:02               32                      3495 s
20:03               32                      3555 s
20:04               32                      3495 s
20:05               32                      3555 s
20:06               33                      3495 s
20:07               33                      3555 s
20:08               33                      3495 s
20:09               33                      3555 s
20:10               32                      3496 s
20:11               32                      3556 s
20:12               32                      3496 s
20:13               32                      3556 s
20:14               33                      3496 s
20:15               33                      3556 s
20:16               33                      3496 s
20:17               33                      3556 s
20:18               32                      3496 s
20:19               33                      3556 s
20:20               33                      3496 s
20:21               33                      3556 s
20:22               32                      3497 s
20:23               32                      3557 s
20:24               33                      3497 s
20:25               33                      3557 s
20:26               33                      3497 s
20:27               33                      3557 s
20:28               32                      3497 s
20:29               32                      3557 s
20:30               33                      3497 s
20:31               33                      3557 s
20:32               32                      3497 s
20:33               32                      3557 s
20:34               33                      3498 s
20:35               33                      3558 s
20:36               33                      3498 s
20:37               32                      3558 s
20:38               32                      3498 s
20:39               32                      3558 s

The patched version remained stable between 32 and 33 connections throughout the 39-minute sample.

No SOGo container restart occurred, and the container remained healthy.

Interpretation

The three versions show clearly different behaviour:

SOGo/SOPE 5.12.10 unpatched:
15 → 58 connections in approximately 45 minutes
Continuous growth was observed

SOGo/SOPE 5.12.9:
Approximately 5–9 stable connections
Unused connections were released well before wait_timeout

SOGo/SOPE 5.12.10 patched:
Approximately 32–33 stable connections
No continuous growth was observed

The official patch appears to fix the unbounded SQL channel accumulation responsible for exhausting MariaDB's connection limit.

The patched version does not behave identically to 5.12.9. It retains a larger number of idle connections, and the oldest idle time repeatedly approaches the configured MariaDB timeout:

Approximately 3495–3558 seconds

The alternating idle times and stable connection count suggest that MariaDB expires old idle connections near wait_timeout=3600, after which SOGo opens or reuses replacement connections.

The important result is that the total count remains bounded instead of growing continuously.

Result

The fix is validated for the original connection-exhaustion problem:

  • the connection count no longer grows continuously;
  • it remains stable at approximately 32–33;
  • the container remains healthy;
  • the container does not restart;
  • all ten workers remain active;
  • MariaDB's connection limit is no longer approached during the observation period.

However, the patched 5.12.10 build retains approximately four to six times more idle SQL connections than 5.12.9.

It may therefore be useful to investigate whether this remaining difference is expected.

Questions

  1. Is a steady pool of approximately 32–33 SQL connections expected with ten sogod workers under SOGo 5.12.10?

  2. Is it expected that many connections remain idle until they approach MariaDB's wait_timeout?

  3. Does the patch intentionally prevent unbounded channel allocation without restoring the more aggressive channel cleanup behaviour observed in 5.12.9?

  4. Should any additional channel release paths be reviewed to bring the connection count closer to the 5.12.9 behaviour?

Conclusion

Commit 152f44b90e08013b5c132473a2de249682d997df successfully prevents the continuously increasing MariaDB connection count observed with the original SOGo/SOPE 5.12.10 release.

The primary production issue appears fixed.

A secondary difference remains: patched 5.12.10 stabilizes at approximately 32–33 idle connections, whereas 5.12.9 stabilizes at approximately five to nine under the same configuration.

Issue History

Date Modified Username Field Change
2026-09-03 11:37 nordlead New Issue
2026-09-03 11:55 qhivert Note Added: 0018537
2026-09-03 11:55 qhivert Assigned To => qhivert
2026-09-03 11:55 qhivert Status new => assigned
2026-09-03 11:59 nordlead Note Added: 0018538
2026-09-03 15:13 qhivert Note Added: 0018540
2026-09-03 15:13 qhivert Status assigned => feedback
2026-09-03 18:53 nordlead Note Added: 0018541
2026-09-03 18:53 nordlead Status feedback => assigned