Sticky Transaction Isolation Level in Pooled Connections

omg!  Why are we getting so many deadlocks on the web site?!

When you change the isolation level on a pooled connection, it stays changed.  If you want to run a few things in a higher isolation level and you set the level to Serializable on a TransactionScope, finish your work, and complete the TransactionScope, the connection is returned to the pool with the current isolation level.  It does not revert to its default isolation level.

Our friends at Microsoft say this is by design: Article ID: 972915.

If you set it up, set it back down before releasing the connection.

Advertisements