Friday, April 13, 2007

PostgreSQL Connection Pooling

I use npgsql for quite a few projects, and it performs really well. I ran into an interesting error today, though. Sometimes a transaction dies while incomplete, and all subsequent connections will fail with "current transaction is aborted". It turns out that the connection pooling in Npgsql is a bit optimistic, and will keep trying to re-use the connection with the aborted transaction on it!

I solved the problem by adding Pooling=false; to my connection string.

No comments: