From: Ricardo P. (JIRA) <nh...@gm...> - 2011-05-06 16:12:29
|
[ http://216.121.112.228/browse/NH-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21008#action_21008 ] Ricardo Peres commented on NH-2107: ----------------------------------- Davy Brion described the problem one year ago: http://davybrion.com/blog/2010/05/avoiding-leaking-connections-with-nhibernate-and-transactionscope/ I don't know if NHibernate can be changed to use only ambient transactions without the need for its own transactions, and keep things from leaking, but it is a known fact that, since ever, we need its own transactions. > Database connection is not closed after rollback in TransactionScope > -------------------------------------------------------------------- > > Key: NH-2107 > URL: http://216.121.112.228/browse/NH-2107 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 2.1.2.GA > Reporter: William Lai > Attachments: ProgramToReproduce.zip > > > .Net Framework Version: 3.5 > Database: SQL Server 2005 > We have just migrated from version 1.2.1 to 2.1.2GA since we need to integrate multiple layer of components using the TransactionScope. After some testing, we find that the database connection increases continuously after every transaction rollback. At the end, all the connections in the connection pool are used up. The problem does not occur in commit case. > Here is the testing code: > ISession session = null; > Test test = null; // Database object > using (TransactionScope scope = new TransactionScope()) > { > session = NHibernateHelper.OpenSession(); > Test test2 = new Test(); > test2.Name = DateTime.Now.ToString(); > session.SaveOrUpdate(test2); > //scope.Complete(); > } > After running the above case, a new connection will be used in SQL Server. The connection will not free up in SQL Server until we close our application. > Any advise for the problem? Thanks in advance. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |