Home Dashboard Directory Help
Search

Safe handle->ObjectDisposedException & SqlTransaction.Dispose by Egor Sinkevich


Status: 

Closed
 as Fixed Help for as Fixed


2
0
Sign in
to vote
Type: Bug
ID: 779588
Opened: 2/20/2013 2:52:35 AM
Access Restriction: Public
0
Workaround(s)
view
2
User(s) can reproduce this bug

Description

Hi Guys!

We have server farm and recently have got really strange errors almost in the same time on the different servers in the farm. What we've got is ObjectDisposedException on the call to the SqlTransaction.Dispose. After several days of investigating we think that this is .NEt bug but caused by Sql Server. We didn't manage to reproduce the problem and only have a call stack. But even from the call stack it is obivious that this is bug.
Please have a look.

System.ObjectDisposedException: Safe handle has been closed
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
at SNINativeMethodWrapper.SNIReadSync(SafeHandle pConn, IntPtr& packet, Int32 timeout)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
at System.Data.SqlClient.TdsParserStateObject.CleanWire()
at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
at System.Data.SqlClient.SqlInternalTransaction.Rollback()
at System.Data.SqlClient.SqlInternalTransaction.Dispose(Boolean disposing)
at System.Data.SqlClient.SqlTransaction.Dispose(Boolean disposing)
.... <our code> ...

Dispose method was called just once and from the finally block.
At the same time we had several timeouts on the SQL server and probably most important thing that at the same time we had timeout on the database file autogrow operation.

So, IMHO there are 2 problems:
1. Exception should never be throws from the Dispose
2. Something that caused this problem

PS:
Same/similar problem
http://social.msdn.microsoft.com/Forums/uk/sqldatabaseengine/thread/2e98ec85-9ce0-452c-89c4-3cb6c4167590
Details
Sign in to post a comment.
Posted by Microsoft on 4/10/2013 at 9:36 PM
Hi Egor,

Thanks for reporting this issue. This will be fixed in a future release of .Net Framework. Please let us know if you have further questions.

Thanks,

Young Gah Kim
Development Lead
ADO.NET and DataSet Team
Posted by Microsoft on 2/21/2013 at 10:26 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 2/21/2013 at 1:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.