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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to