
11.24.2004
Thread Abort During ExecuteReader Corrupts SqlConnection Pool
Working on some multithreaded SQL calls, and came across this.
Looks like this is an old problem, probably ok in .NET 1.1. Confirmed that my version of System.Data.dll is later than the one shown here.
FIX: Thread Abort During SqlCommand.ExecuteReader Corrupts SqlConnection Pool
Bottom line - trying to determine the ramifications of the following:
An app with a background thread is working on a long query. The user wants to close the app, but can't stop the thread cuz it's on a blocking SQL call (ExecuteNonQuery for example). The App Domain is unloaded, since all the "foreground" threads are gone. The background thread is killed (Abort is called). What happens to the SQL connection, query, etc. ??
From Thread.IsBackgroundProperty docs.
Looks like this is an old problem, probably ok in .NET 1.1. Confirmed that my version of System.Data.dll is later than the one shown here.
FIX: Thread Abort During SqlCommand.ExecuteReader Corrupts SqlConnection Pool
Bottom line - trying to determine the ramifications of the following:
An app with a background thread is working on a long query. The user wants to close the app, but can't stop the thread cuz it's on a blocking SQL call (ExecuteNonQuery for example). The App Domain is unloaded, since all the "foreground" threads are gone. The background thread is killed (Abort is called). What happens to the SQL connection, query, etc. ??
From Thread.IsBackgroundProperty docs.
A thread is either a background thread or a foreground thread. Background threads are identical to foreground threads, except that background threads do not prevent a process from terminating. Once all foreground threads belonging to a process have terminated, the common language runtime ends the process by invoking Abort on any background threads that are still alive.
Comments:
Post a Comment