durusmail: quixote-users: [slightly OT] persistent postgresql connection problem
[slightly OT] persistent postgresql connection problem
2004-10-12
2004-10-12
[slightly OT] persistent postgresql connection problem
Ksenia Marasanova
2004-10-13
>
> If it's "full of postgres connections", then the following does not
> explain your problem, but ... When debugging this, keep in mind
> that the method described in that Wiki page creates and holds one
> connection for each process.  With SCGI, by default, Quixote
> creates up to 5 processes, I believe, when it needs to in order to
> handle multiple concurrent requests.  It's supposed to work that
> way.  It prevents request handlers from using the same connection
> at the same time.
>
> So, even when you solve the problem that you describe, you may find
> more than one connection in the process list.
>

I finally  found out that my Publisher class was initializing 3
connections instead of 1...  which were obviously multiplied each time
the new process was created. And in combination with multiple
applications using the same database and the same Publisher class, it
was a little too much for the default max_connection setting of
PostgreSQL.

Also, there must be a commit after each select, to get rid of '(in
transaction)' connection state. I am not sure if a connection in such
state can cause troubles, but commiting after select also solves
problem when separate SCGI applications (and probably concurrent
requests also) that can not see changes in the database made by each
other.

Ksenia.







reply