Symptoms
Attempting to access webmail occasionally gives a 500 error when Calendar and Contacts Server (CCS) is installed, and errors similar to the following can be found in /opt/cpanel-ccs/data/Logs/error.log
.
2020-09-04T17:47:20+0100 [caldav-47] pg8000.core.ProgrammingError: (u'FATAL', u'53300', u'sorry, too many clients already', u'proc.c', u'336', u'InitProcess', u'', u'')
Description
The issue will occur when cpanel-ccs
attempts to run more postgres
processes than the maximum number of configured Postgres connections.
Please note that there will be a number of idle connections based on the number of cores the system has, which means systems with 64+ cores will reach the default process limit without any active connections.
Workaround
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Run the following command to find the number of
postgres
processes thecpanel-ccs
user is running.[root@server ~]cPs# ps aufx | egrep 'cpanel-.+postgres: caldav' | grep -v ^root | wc -l
72
[root@server ~]cPs# - Find the current
max_connections
value.[root@server ~]cPs# grep max_connections /opt/cpanel-ccs/conf/caldavd-dev.plist
<string>-c max_connections=64</string>
[root@server ~]cPs# - Open
/opt/cpanel-ccs/conf/caldavd.tmpl
in your preferred text editor. - Locate the
max_connections
entry under thePostgres
key.<!-- Support for Postgres -->
<key>Postgres</key>
<dict>
<key>Options</key>
<array>
<string>-c deadlock_timeout=[% PGLOCKTIMEOUT %]s</string>
<string>-c max_connections=[% PGMAXCONNECTIONS %]</string> - Replace
[% PGMAXCONNECTIONS %]
with a value greater than the number found using thepgrep
command. - Save the changes and exit the text editor.
- Rebuild the CCS configuration.
/opt/cpanel-ccs/bin/rebuildccsconfig
- Verify the
caldavd-dev.plist
file shows the updatedmax_connections
value.grep max_connections /opt/cpanel-ccs/conf/caldavd-dev.plist
- Restart the CCS service.
/usr/local/cpanel/scripts/restartsrv_cpanel_ccs