For completeness: the issue was I had a function that took a dburi, then created another engine, that was called repeatedly. Once I changed it to take an *engine*, the problem cleared up.
(side tip: psql has a "show all" command that is useful for seeing the config info, on machines where one can't see the config file directly) Thanks again for the help! Gregg On Jun 17, 8:04 pm, Michael Bayer <[email protected]> wrote: > On Jun 17, 2010, at 8:14 PM, Gregg Lind wrote: > > > What built-in tools / techniques should I use when trying to > > troubleshoot the 'too many clients already' fatal error. > > > 1. Connecting to PG locally, fwiw, > > 2. I have full privileges on the db > > > My connections can come from at least: > > > - create_engine > > > I try to be careful to "del engine" after I'm done with them, but > > maybe they're not being freed? Clearly, I don't understand the > > situation, would appreciate insights. > > "del engine" suggests you're not doing things as intended, unless you're in > some very specific kind of testing scenario. An application should have > just one create_engine() call for the life of the whole process, per database > backend. Since its a connection pool, it is not intended to be thrown away > before the application is completed. > > By setting the max size on the pool used by your single engine, the total > connections that can be open will be throttled and you won't get a "too many > clients" error. Though if you have connections that are not being released > in enough time for the next request that needs one, you'd instead get pool > timeouts. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
