Description
vbprogr created an issue — 5th August 2016, 7:32:04:
I use NHibernate 3.4.1.400 with Npgsql 3.1.5.0 and when testing with high load sometimes server is completely blocked by this exception.
Can I expect a fix on your side?
vbprogr added a comment — 6th August 2016, 5:52:03:
After downgrading to postgresql 9.4.4 it works much much better! (but still reproducable)
vbprogr added a comment — 6th August 2016, 9:49:08:
I re-checked that all NHibernate sessions are correctly disposed so no connections are opened on my side. After some time I have 0 sessions opened and still getting "Connection pool has been exhausted". It's weird that I can't reproduce it on my dev machine (only on production - Windows Server 2008 R2).
pgAdmin - Server Status actually shows those 140 connections there doing nothing.
Oskar Berggren added a comment — 8th August 2016, 8:18:25:
"fix on our side"
Well, why do you think it's a problem in NHibernate? What would that fix be?Do you have a minimal test case that reproduces the issue?
Are you using System.Transactions/ambient transaction, or ONLY NHibernate BeginTransaction()?
vbprogr added a comment — 8th August 2016, 10:38:34:
<~oskar.berggren>, I think that it's either NHibernate or Npgsql bug because I'm sure that all ISessions are always disposed on my side (I made a wrapper for session factory and sessions which counted OpenSession and Dispose calls).
I don't have any reproducable test, it happens only in production environment but not on my dev machine and only with full cpu load. May be I will try to make it but it can take much time because I can't just edit & run.
I use only BeginTransaction.
Frédéric Delaporte added a comment — 12th May 2017, 17:14:01:
When not using
TransactionScope
, connection automatically acquired by session are always released at worst on session close. So if all your sessions are disposed, and you are not supplying your own connection when opening them, it looks like it would be a bug in npgsql driver.If you supply your own connection when opening a session, then it is your responsibility to close it. The session will not close it.