Home > SSIS > SSIS Script Component Error with PostExecute: 0xC001404D

SSIS Script Component Error with PostExecute: 0xC001404D


I spent some time resolving an interesting error today in an SSIS component I was writing that included a Script Component.
The error message is as follows

 
The error was caused by setting value to the ReadWrite variable .

public

override void Input0_ProcessInputRow(Input0Buffer Row){

ReadWriteVariables[

"Username"].Value = Row.DROPID;

SetRecordCount();

}

A bit of research on the error code 0xC001404D indicated that the variable is being locked somewhere along the way – and so gets caught in a deadlock.

I thought this was quite strange as I dont use this variable anywhere else in this package so there wasnt anywhere else that it could be getting locked for read or write.
I eventually realised that the only other place I had added the variable was to to the ReadWriteVariables list in the properties of the Script Component:

As soon as I removed this variable name from that field, I was able to get my script component to successfully run.

This made me think that the field on the properties page must be performing the

VariableDispenser.LockOneForRead(CRMConstants.RECORDCOUNT, ref RefRecordCounts);

and corresponding
RefRecordCounts.Unlock();

The solution solve this issue is as follows

1.Get the all the Vaiables from the VariableDispenser

IDTSVariables100 ProprtyValues;

VariableDispenser.GetVariables(

out ProprtyValues);

2.lock for Read/Write

VariableDispenser.LockOneForWrite(VarName,

ref ProprtyValues);

3. Read/write vale

ProprtyValues[VarName].Value = VarValue;

4.Unlock the variables

ProprtyValues.Unlock();

So it turns out that removing the variable name from the ReadWriteVariables field is the only way to allow you to write to it from within the script component code.

 

 
Advertisements
Categories: SSIS
  1. banzai
    July 3, 2013 at 9:05 am

    thank’s of lot,guy!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: