Release Lock for Variables Used in Execution Task Execution | SSIS
I have a package with a Foreach Container and Run a process task inside a ForEach container . On some error in the Execute Process Task, it is redirected to the OnError event handler for the ForEach Container .
I am retrieving Error from .exe using the StandardErrorvariable property of the Tasks and using that in the task script that is present in the OnError event handler .
The script task is not responding
Error: Deadlock encountered while trying to lock the variable "User :: ErrorExcelName, User :: ErrorFolder, User :: ErrorMessage, User :: FileName" for read access. The lock cannot be obtained after 16 attempts and timeout.
How to fix it?
You can easily fix the problem by manipulating explicit variable locking in your code. (Without adding variables to properties ReadOnlyVariables
and ReadWriteVariables
.
string strFilename;
Variables lockedVariables = null;
Dts.VariableDispenser.LockOneForRead("FileName", ref lockedVariables);
strFilename = lockedVariables["FileName"].Value;
lockedVariables.Unlock();
Links
- http://www.sqlis.com/sqlis/post/A-deadlock-was-detected-while-trying-to-lock-variables-in-SSIS.aspx
- http://sqlblogcasts.com/blogs/mohitnayyar/archive/2007/09/23/update-ssis-deadlock-was-detected-while-trying-to-lock-variables-mohit-nayyar.aspx