Forum OpenACS Q&A: "Sorry, too many clients already"

Collapse
Posted by Henry Minsky on
Has anyone seen this error before? Is there some parameter in the Postgres server which limits the number of client connections?

I have a server set up for students on this host, with 13 separate nsd processes running individual copies of ACS all at the same time, which might be what is provoking this error.

   Error: Ns_PgOpenDb(postgres):  Could not connect to 
localhost::openacs325:  Sorry, too many clients already
    

[26/Apr/2001:22:06:35]
    Error: dbdrv: failed to open 
database 'postgres:localhost::openacs325'

[26/Apr/2001:22:06:35]
    Error: could not allocate 2 handles from pool "main"
    could not allocate 2 handles from pool "main"
        while executing
    "ns_db gethandle main 2"
        (procedure "send_scheduled_spam_messages" line 19)
        invoked from within
    "send_scheduled_spam_messages"
        ("eval" body line 1)
        invoked from within
    "eval [concat [list $proc] $args]"
        (procedure "ad_run_scheduled_proc" line 43)
        invoked from within
    "ad_run_scheduled_proc {t f 1810 send_scheduled_spam_messages {} 
988174552 0 t}"
    Notice: Running scheduled proc wd_mail_errors...
Collapse
Posted by Don Baccus on
PG defaults to a limit of 32 connections.  This can be overridden by starting the postmaster with a higher value - I use 100 on my personal server.  "postmaster -N 100 ..."

You should match the PG number of backends to the number of connections you let OpenNSD make (perhaps planning for at least one more PG backend so you can be assured of having one available to use with PSQL in a pinch).  Doing so will cause OpenNSD to make the thread  wait or give a reasonable error rather than crashing your script.

Collapse
Posted by David Kuczek on
Hello Don,

You said:

I use 100 on my personal server. "postmaster -N 100 ..."

You should match the PG number of backends to the number of connections you let OpenNSD make (perhaps planning for at least one more PG backend so you can be assured of having one available to use with PSQL in a pinch).


In the standard nsd.tcl script for aolserver the Connections are set to
5 in ns_section "ns/db/pool/main"
5 in ns_section "ns/db/pool/log"
2 in ns_section "ns/db/pool/subquery"

Is it correct to set these to 99 when I set -N to 100?

Thanks
Collapse
Posted by Hans Gaasenbeek on
Where should I add this option? (I am having the same problem...) I am running the .rpm version of Postgresql 7.1, and when I add "-N 100" to the line starting postgresql (in /etc/rc.d/init.d/postgresql) it refuses to start up.
Collapse
Posted by David Walker on
I have 2 postgres clients (web servers) configured with 5,5, and 2
pools.  This should total 24.  However my logs show some database
unavailable errors and there were 32 postmasters running when I
looked.

Should I be worried?  Or just throw more postmasters at it?

Can anybody help me, I am not shure where can I put the option "-N 100" to increase the number of the Postmaster..
/etc/rc.d/init.d/postgresql

I am running out of connections for the instances of OACS and I need to increase it.
Thanks...
Collapse
Posted by Jun Yamog on
Hi Luis,

Look for something like this.

${PGHOME}/bin/postmaster -o '-N 128 -B 2000 -o -S2000' start

Collapse
Posted by David Walker on
Look in postgresql.conf (in /var/lib/pgsql/data/postgresql.conf on my machines) for "max_connections = xx"