FATAL: sorry, too many clients already

Post Reply
Username
Posts: 262
Joined: 18 Feb 18 22:21

FATAL: sorry, too many clients already

Post by Username » 30 Nov 18 10:36

I've been getting a lot of these warnings and the following disconnects when I import files.
I have the postgres to accept 100 connections as recommended with five users although only I as admin was loged in.

What I could see on the server was that 4-6 Postgres processes was running at 90% CPU but as time passed the number of processes increased and load sharing between them. In the end there were at least 32 postgres processes running and evenly sharing the load although they together used everything my quad core i7 had to offer.

The PSu threw warnings about:
FATAL: sorry, too many clients already
And the postgres server reported the same.

2018-11-30 09:50:00.282 CET [91763] FATAL: sorry, too many clients already
2018-11-30 09:50:00.295 CET [91764] FATAL: sorry, too many clients already
2018-11-30 09:50:00.306 CET [91765] FATAL: sorry, too many clients already
2018-11-30 09:50:00.319 CET [91766] FATAL: sorry, too many clients already


Would this be related to PSu or more possible the PostgreSQL server/config?

macOS server 10.13.6
macOS client 10.14.1
PSu 1755 pg
Postgres.app 2.1.5 PostgreSQL 10.5 on x86_64-apple-darwin14.5.0, compiled by Apple LLVM version 7.0.0 (clang-700.1.76), 64-bit
Attachments
FATAL.  sorry, too many clients already.png
FATAL. sorry, too many clients already.png (563.06 KiB) Viewed 1418 times
PSu Server 5 & Postgres 12 on macOS 10.14
PSO 5 on Windows Server 2016

- I'm the user

Hert
Posts: 6342
Joined: 13 Sep 03 7:24

Re: FATAL: sorry, too many clients already

Post by Hert » 30 Nov 18 11:24

What value is set for max_connections in Postgres config? Did you follow the guideline mentioned in the installation instructions for PSU for that config setting?
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

Username
Posts: 262
Joined: 18 Feb 18 22:21

Re: FATAL: sorry, too many clients already

Post by Username » 30 Nov 18 13:34

Yes I have followed your guide and the max_connections is set to 100.

If I understand PSu correctly it opens up a new connection and logs in for each db query and then drops it only to log in once again etc.
Could it be that the PSu open and closes them too fast for the server to close them down?
PSu Server 5 & Postgres 12 on macOS 10.14
PSO 5 on Windows Server 2016

- I'm the user

Username
Posts: 262
Joined: 18 Feb 18 22:21

Re: FATAL: sorry, too many clients already

Post by Username » 30 Nov 18 14:01

When running Verify Folder, my PostgreSQL log looks like this:


2018-11-30 13:55:25.296 CET [6274] LOG: connection authorized: user=idimager_main database=photosupreme
2018-11-30 13:55:25.316 CET [6274] LOG: disconnection: session time: 0:00:00.024 user=idimager_main database=photosupreme host=192.168.21.15 port=57458
2018-11-30 13:55:25.326 CET [6272] LOG: disconnection: session time: 0:00:00.111 user=idimager_main database=photosupreme host=192.168.21.15 port=57456
2018-11-30 13:55:25.538 CET [6275] LOG: connection received: host=192.168.21.15 port=57459
2018-11-30 13:55:25.543 CET [6275] LOG: connection authorized: user=idimager_main database=photosupreme
2018-11-30 13:55:25.580 CET [6275] LOG: disconnection: session time: 0:00:00.042 user=idimager_main database=photosupreme host=192.168.21.15 port=57459
2018-11-30 13:55:25.584 CET [6276] LOG: connection received: host=192.168.21.15 port=57460
2018-11-30 13:55:25.589 CET [6276] LOG: connection authorized: user=idimager_main database=photosupreme
2018-11-30 13:55:25.625 CET [6276] LOG: disconnection: session time: 0:00:00.041 user=idimager_main database=photosupreme host=192.168.21.15 port=57460
2018-11-30 13:55:25.635 CET [6277] LOG: connection received: host=192.168.21.15 port=57461
2018-11-30 13:55:25.639 CET [6277] LOG: connection authorized: user=idimager_main database=photosupreme
2018-11-30 13:55:25.670 CET [6277] LOG: disconnection: session time: 0:00:00.035 user=idimager_main database=photosupreme host=192.168.21.15 port=57461
2018-11-30 13:55:25.674 CET [6278] LOG: connection received: host=192.168.21.15 port=57462
PSu Server 5 & Postgres 12 on macOS 10.14
PSO 5 on Windows Server 2016

- I'm the user

Hert
Posts: 6342
Joined: 13 Sep 03 7:24

Re: FATAL: sorry, too many clients already

Post by Hert » 30 Nov 18 14:13

PSU is a multi threaded application and per thread connections are needed/opened/closed when not needed. Some are pooled, some are not.
Threads are being created and closed all the time and when a heavy thread operation is in progress (like verify) then more connections may be opened as the need arises and the pool overflows.

Just pump up the value as you apparently need more.
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

Username
Posts: 262
Joined: 18 Feb 18 22:21

Re: FATAL: sorry, too many clients already

Post by Username » 30 Nov 18 14:38

Great.
Will try 200 sessions and see if there's any performance or memory impacts in either direction for clients and the server.

Thanks again.

btw
As I've not seen any of this before, could it be due performance and efficiency enhancements done to PSU in which it works faster and the 100 connections are not keeping up? :)
PSu Server 5 & Postgres 12 on macOS 10.14
PSO 5 on Windows Server 2016

- I'm the user

Hert
Posts: 6342
Joined: 13 Sep 03 7:24

Re: FATAL: sorry, too many clients already

Post by Hert » 30 Nov 18 16:34

Username wrote:
30 Nov 18 14:38
As I've not seen any of this before, could it be due performance and efficiency enhancements done to PSU in which it works faster and the 100 connections are not keeping up? :)
Yes, that is because of the recent enhancements. As you can read on https://whatsnew.idimager.com, the Connection Pooling had a big overhaul in build 1755.
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

rdv4rjm
Posts: 95
Joined: 08 May 18 22:29

Re: FATAL: sorry, too many clients already

Post by rdv4rjm » 01 Dec 18 6:24

Was getting lost of same error messages until last week, I upgraded from 32gb to 128gb ram.
No error messages since.
Hope this helps.

bimo
Posts: 113
Joined: 29 Aug 07 22:34
Location: Germany

Re: FATAL: sorry, too many clients already

Post by bimo » 21 Dec 18 15:14

Hert wrote:
30 Nov 18 14:13
Just pump up the value as you apparently need more.
At that time I had already set max_connections=200; as that didn't help I changed the value stepwise until 600 today - and I still get the error with recent Version 4.3.2.1826. PSU is running on win10 (i7-8700 with 16GB).
Michael

bimo
Posts: 113
Joined: 29 Aug 07 22:34
Location: Germany

Re: FATAL: sorry, too many clients already

Post by bimo » 21 Dec 18 15:52

Actual snapshot: running version detection on lots of 6 folders with no more than 500 images in total. Win's taskmanger now shows 20 pages of Background processes called "PostgreSQL Server"...
Michael

Hert
Posts: 6342
Joined: 13 Sep 03 7:24

Re: FATAL: sorry, too many clients already

Post by Hert » 22 Dec 18 15:19

bimo wrote:
21 Dec 18 15:52
Win's taskmanger now shows 20 pages of Background processes called "PostgreSQL Server"...
Those instances are started by Postgresql and are not PSU related. To get the active connections utilized by PSU, run this query in PostgreSQL;

Code: Select all

SELECT 
    pid,
    datname,
    usename,
    application_name,
    client_hostname,
    client_port,
    backend_start,
    query_start,
    query,
    state
FROM pg_stat_activity
WHERE usename = 'idimager_main'
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

Post Reply