Thursday, March 29, 2012

Error when trying to use checkpoint file

I have a package with settings SaveCheckpoints=True and CheckpointUsage = Never. After the package failed I fixed the cause of failure by setting a database column to allow nulls. Then I went to our web app that we built to monitor package execution and clicked on the button to restart the package. The web app loads the package and then sets the CheckpointUsage property of the package object to 'Always'. Then it executes the package in a new thread. The package then produced this error:

Checkpoint file "E:\Package1Checkpoint" failed to open due to error 0x80070005 "Access is denied.".

Since there was only one remaining task to run in the package I ran it manually.

Now here is the really interesting part. I then needed to run the same package but with different parameters. When I attempted to run it with the saved checkpoint settings (CheckpointUsage=Never, SaveCheckpoints=True) I got this error:

"An existing checkpoint file is found with contents that do not appear to be for this package, so the file cannot be overwritten to start saving new checkpoints. Remove the existing checkpoint file and try again. This error occurs when a checkpoint file exists, the package is set to not use a checkpoint file, but to save checkpoints. The existing checkpoint file will not be overwritten. "

So I then attempted to rename the checkpoint file so it would not interfere, however, it would not let me, saying that the file was in use.

So what I had to do was add a configuration entry which set SaveCheckpoints to False. Then I was able to run the package.

Any ideas?

Could it be that the web app was still executing, and the package executed by web app was still running and holding the checkpoint file? This would explain both "Access denied" when trying to read checkpoint, and "file in use" when trying to delete it.|||

TFYR. I'm reviewing the log entries for when the package "failed". I do not see the 'PackageEnd' log entry so I believe you are correct in that the package was still running and was holding the checkpoint file. I believe it was running a very long-running ExecuteDTS2000 task. ' I must have assumed that when a previous task failed that it had failed the package also, which evidently was not the case. Anyway, below is the code from the web app that launches the package if you are interested. Thanks.

...

pkg.CheckpointUsage = DTSCheckpointUsage.Always;

RunPackage();

}

private void RunPackage() {

ThreadStart threadStart = new ThreadStart(PackageExecute);

Thread thread = new Thread(threadStart);

thread.Name = pkg.Name;

thread.Start();

}

private void PackageExecute() {

try

{

pkg.Execute();

}

catch (Exception ex)

{

lblMessage.Text = ex.Message;

}

}

No comments:

Post a Comment