Showing posts with label forceexecutionresult. Show all posts
Showing posts with label forceexecutionresult. Show all posts

Friday, March 23, 2012

ForceExecutionResult is ignored by parent

1 Add a Sequence Container.
2 Add a Script Task to the contianer, and set the script to fail, Dts.TaskResult = Dts.Results.Failure
3 Set the ForceExecutionResult on the Script to Success.
4 Execute the package.

The container fails, so it detects the Dts.Results.Failure, and ignores ForceExecutionResult. The task itself is Green, so that indicates success. I think this is wrong, as ForceExecutionResult should be observed by both the task and parent container. Not that it should matter, I think, FailParentOnFailure is false. By design? (Sep CTP)
Ok, so there is a simpler issue here. The sequence container takes no notice of the ForceExecutionResult. Try a container with a simple task that always succeeds. Set ForceExecutionResult on the container to Failure, and the container still succeeds (goes green).|||

Containers don't fail because their children fail. Containers fail because one of their settings (MaxErrorCount, FailParentOnFailure, etc) mandates it to fail.

The task isn't raising an error. So MaxErrorCount doesn't take effect. A failed task doesn't fail the parent by default. Neither is FailParentOnFailure set to true.

Here, like the Disable/Enable, is a brute force method of making something happen. You've made the conceptual assumption that because tasks fail when they have errors, if the task is forced to look like it failed, the parent should behave the same as a task that failed because it had errors.

The feature does what it says and no more. It forces the return value to false. Nothing more. It effects only those features that key on the return value. Precedence constraints are effected by the execution result, failing the parent is not. Neither is there an error raised.

If you set fail parent or fail package on failure, it will fail the sequence.

If you return an error from the script task, it will fail the parent if MaxErrors is set to 1.

HTH,
K

ForceExecutionResult doesn't do what its supposed to.

[Microsoft follow-up]

All,

According to BOL the ForceExecutionResult property can be used to imitate real-time failure (http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.dtsforcedexecresult.aspx).

However, I've just done a very simple test and this appears to not be the case. Here's the repro:

    Start a new package Drag on a Sequence Container Set the sequence container property ForceExecutionResult='Failure'

When you run the package the sequence container will complete successfully. As far as I can see its not supposed to.

Any comments?

Thanks

Jamie

I've just dragged a script task onto the same package. Opened the script and closed it again to make sure it compiles. Set ForceExecutionResult='Failure'.

When I run the package the script task fails. This is the behaviour I would expect so why is the Sequence Container different?

We have seen problems in the past with unexpected Sequence Container behaviour: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1875222&SiteID=1&mode=1

This is a bug as far as I can tell.

-Jamie

|||

Hmm... Interesting...

Trying it with a data flow task or a script tasks, it shows a failure, but with the sequence container it succeeds.

Looks like a bug in the sequence container?

BobP

|||

BobP - BIM wrote:

Hmm... Interesting...

Trying it with a data flow task or a script tasks, it shows a failure, but with the sequence container it succeeds.

Looks like a bug in the sequence container?

BobP

Definitely. I'm waiting on a reply from Microsoft befroe I submit it to Connect.

-Jamie

|||

Setting ForcedExecutionResult=Failure doesn't produce container failures on a sequence container... or a for loop, or a foreach loop, or the package itself, or an event handler. Seems like a bug.

|||I just went through the codes and seems like we only apply the ForceExecutionResult value for Tasks, not containers. Package, Sequence, Foreach Loop, and For Loop are all in the container category so the property does not get apply to them. It seems like a bug to me also.|||

Cho Yeung - msft wrote:

I just went through the codes and seems like we only apply the ForceExecutionResult value for Tasks, not containers. Package, Sequence, Foreach Loop, and For Loop are all in the container category so the property does not get apply to them. It seems like a bug to me also.

Hi Cho,

TaskHost is in the container category as well so its definitely a bug.

Do you need me to submit it on Connect?

-Jamie

|||I am going to file a bug internally. Thanks for bringing this up|||It is better to have Jamie open the bug so he can stay in the loop.|||

Bob Bojanic - MSFT wrote:

It is better to have Jamie open the bug so he can stay in the loop.


Thanks Bob. Its done.

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=288294

-Jamie

sql