I have a strange problem that I can reliably reproduce. I am calling a
stored procedure using NH 2.1.2 and SQL Server 2008. The stored proc
throws an exception. With NH logs enabled, the logs show receipt of
the transaction, but then there's a long delay after the log message
"aggressively releasing database connection." The delay occurs for all
threads in the log, not just the one that called the proc.

In the excerpt below, note the timestamp between the second-to-last
line and the last line. It's 42 seconds.

What could cause this sort of hanging?

2010-11-30 22:52:55,322 [257] INFO  Loader: exec ADD_AGENT @p0, @p1,
@p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11
2010-11-30 22:52:55,322 [257] DEBUG DriverConnectionProvider:
Obtaining IDbConnection from Driver
2010-11-30 22:52:55,322 [257] DEBUG ADOExceptionReporter: SQL
Exception
System.Data.SqlClient.SqlException: Procedure: ADD_AGENT | Message:
Duplicate record. Data will not be saved.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
   ...
   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean
autoDiscoverTypes, Boolean callable, RowSelection selection,
ISessionImplementor session)
2010-11-30 22:52:55,322 [257] WARN  ADOExceptionReporter:
System.Data.SqlClient.SqlException: Procedure: ADD_AGENT | Message:
Duplicate record. Data will not be saved.
   ...
2010-11-30 22:52:55,322 [257] ERROR ADOExceptionReporter: Procedure:
ADD_AGENT | Message: Duplicate record. Data will not be saved.
2010-11-30 22:52:55,322 [257] DEBUG ConnectionManager: aggressively
releasing database connection
2010-11-30 22:52:55,322 [257] DEBUG ConnectionProvider: Closing
connection
2010-11-30 22:52:55,322 [257] DEBUG ADOExceptionReporter: could not
execute query
[ exec ADD_AGENT @p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9,
@p10, @p11 ]
...
System.Data.SqlClient.SqlException: Procedure: ADD_AGENT | Message:
Duplicate record. Data will not be saved.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
   ...
   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
   at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean
autoDiscoverTypes, Boolean callable, RowSelection selection,
ISessionImplementor session)
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
QueryParameters queryParameters, Boolean returnProxies)
   at
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor
session, QueryParameters queryParameters, Boolean returnProxies)
   at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters)
2010-11-30 22:52:55,322 [257] WARN  ADOExceptionReporter:
System.Data.SqlClient.SqlException: Procedure: ADD_AGENT | Message:
Duplicate record. Data will not be saved.
   ...
2010-11-30 22:52:55,322 [257] ERROR ADOExceptionReporter: Procedure:
ADD_AGENT | Message: Duplicate record. Data will not be saved.
2010-11-30 22:52:55,322 [257] DEBUG ConnectionManager: after
autocommit
2010-11-30 22:52:55,322 [257] DEBUG SessionImpl: transaction
completion
2010-11-30 22:52:55,322 [257] DEBUG ConnectionManager: aggressively
releasing database connection
2010-11-30 22:53:37,380 [121] DEBUG SessionImpl: [session-id=1ec87e56-
eb0a-4f96-aa56-cb04004be01f] opened session at timestamp:
634267544173, for session factory: [/165e808502a648e7a24c56ff2f991242]

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to