Update Failure Recovery

Hi,

We purchased and are using wyBuild, wyUpdate, & AutomaticUpdater.

Since we want to use our own dialogs, we initially set automaticUpdater as follows:

automaticUpdater1.IsEnabled = false; automaticUpdater1.Visibility = Visibility.Hidden; automaticUpdater1.KeepHidden = true; automaticUpdater1.UpdateType = wyDay.Controls.UpdateType.DoNothing;

Then when the user clicks Update Now in our dialog we set automaticUpdater as follows:

UpdaterControl.Visibility = Visibility.Hidden; UpdaterControl.IsEnabled = true; UpdaterControl.UpdateType = wyDay.Controls.UpdateType.Automatic; UpdaterControl.ForceCheckForUpdate(true);

And on the automaticUpdater1_ReadyToBeInstalled we do:

if (automaticUpdater1.UpdateStepOn == wyDay.Controls.UpdateStepOn.UpdateReadyToInstall) { // close immediately to install new version automaticUpdater1.InstallNow(); }

And on events automaticUpdater1_ClosingAborted, automaticUpdater1_UpdateFailed, automaticUpdater1_DownloadingOrExtractingFailed, automaticUpdater1_CheckingFailed:

... display an error message.... automaticUpdater1.Visibility = Visibility.Hidden; automaticUpdater1.IsEnabled = false; automaticUpdater1.UpdateType = wyDay.Controls.UpdateType.DoNothing;

If there is an error in the middle of update, such as network connection failure, the update aborts.

If the user then tries the update again, our code again does as above (the user clicks Update Now in our dialog).

However, if there is no longer a network error, the update fails, at least for a time....

It appears that wyUpdate, if it fails may have some period of time that it has the "partial update", and then recovers after that time, or when our application is opened at a later time?

Can you elaborate on what wyUpdate does for error failure and what we should do to best recover?thanks,

Phil Evans

It appears that wyUpdate, if it fails may have some period of time that it has the "partial update", and then recovers after that time, or when our application is opened at a later time?

Can you elaborate on what wyUpdate does for error failure and what we should do to best recover?

What error are you getting? Can you copy & paste it?

Hi Sam, thanks for your response.

Here are the errors and steps to reproduce the problem:

See information above in regard to the code and events processed, etc.

The user clicks on our custom dialog to start the download and update.

Using automaticUpdater properties/methods, the download and update starts.

If I pull out the network cable immediately to remove internet connectivity, at about 0% automaticUpdater1_ProgressChanged, I correctly get this error:Error = Error trying to save file: Error downloading "http://pwb_test.lsa.local/Update/PWBReaderIndividualInstallation/wyserver.wys": The remote name could not be resolved: 'pwb_test.lsa.local'

If I pull out the network cable later, about 5% automaticUpdater1_ProgressChanged, the download and update progresses completely and successfully, even though there is no network connectivity at that point!

If I pull out the network cable on about 1% download:

Eventually automaticUpdater1 times out and gives this error:

Error = Error trying to save file "C:\Users\Phil\wc\3\patentworkbenchreader.all.to.2.2.0.wyu": The operation has timed out.

Or other times, get this error:

Error = Error trying to save file: Error downloading "http://pwb_test.lsa.local/Update/PWBReaderIndividualInstallation/patentworkbenchreader.all.to.2.2.0.wyu": Unable to connect to the remote server

Sometimes, the automaticUpdater1_ProgressChanged starts at a high percent immediately, such as 94%, and it says "extracting" so it seems that the wyu file is downloaded, and it's in the extraction phase?

Put back in the network cable to restore internet connectivity.

The user clicks again to start the download and update.

Sometimes the download and update succeeds, sometimes it fails.

It seems that if I wait several minutes after inducing the failure, and then try again, automaticUpdater1/wyUpdate "refreshes" or "reinitializes", or whatever and then works?

In summary, what I would like to know is: What is the process for automaticUpdater1/wyUpdate error recovery? What should I do to best handle errors, i.e. reinitialize automaticUpdater1/wyUpdate so that the user is not presented with errors, i.e. the process starts over again fresh?

Hi,

Is it a good idea to call the automaticUpdater Cancel method after there is an error and any of these events are fired: automaticUpdater1_ClosingAborted automaticUpdater1_UpdateFailed automaticUpdater1_DownloadingOrExtractingFailed automaticUpdater1_CheckingFailed

In the above events, I now also add:

automaticUpdater1.Cancel();

to what I previously had, which was: automaticUpdater1.Visibility = Visibility.Hidden; automaticUpdater1.IsEnabled = false; automaticUpdater1.UpdateType = wyDay.Controls.UpdateType.DoNothing;

I haven't yet tested.... will get to that tomorrow.

Is that a good approach to "reinitialize" in the event of an error, such as network connectivity, so that the process can start clean the next time the user checks to update?

What is the process for automaticUpdater1/wyUpdate error recovery?

It depends. If it's a downloading error the downloaded file is discarded. If it's a patch error (i.e. the user screws with your app files) then the "catch-all" is attempted to be downloaded that is tried. If there's no "catch-all" then an error is shown.

If an error happen mid-update (that is when wyUpdate is shown and your app is closed) then wyUpdate rollsback the update and starts your app back up and the error event is called.

What should I do to best handle errors, i.e. reinitialize automaticUpdater1/wyUpdate so that the user is not presented with errors, i.e. the process starts over again fresh?

I'm not quite sure what you mean by "reinitialize". The AutomaticUPdater automatically handles errors and gets itself into the best state for retrying.

Thank for your reply Wyatt.

You said:

I'm not quite sure what you mean by "reinitialize". The AutomaticUPdater automatically handles errors and gets itself into the best state for retrying.

Our response:By "reinitialize" I mean start completely over again... discard any partially downloaded files, partially extracted files, etc.

The errors I get are purposely induced by disconnecting the network cable at the start of update download, both immediately as well as a bit later, to see what happens, i.e. how does wyUpdate handle the error and recover.

The results vary, with different errors at different times. And then when the user clicks the "Update Now" button in our custom dialog, we call automaticUpdater1 again, the same as before the error, and sometimes the update works and sometimes it hangs or fails.

It seems like there is a period of time (say 5 - 10 minutes?) that wyUpdate remembers that it was updating, and perhaps tries to resume, sometimes successfully, and not other times.

So it seems it might be best to tell wyUpdate start over COMPLETELY.... discard any partially downloaded files, partially extracted files, etc. and start the download from the beginning.

Would the automaticUpdater Cancel method after there is an error achieve this, and if not what do you suggest?

Thanks

The results vary, with different errors at different times. And then when the user clicks the "Update Now" button in our custom dialog, we call automaticUpdater1 again, the same as before the error, and sometimes the update works and sometimes it hangs or fails.

I'm not really sure resetting everything is the solution to the problem (it sounds more like introducing another problem). Can you list something that the AutomaticUpdater / wyUpdate does that doesn't follow your expectations? Maybe it's a bug -- and rather than working around the bug with an unnecessary feature we should just fix the bug.

Hi Wyatt, thanks for your response. Here are the steps and specific questions:

We click the "Update Now" button in our custom dialog, which then calls automaticUpdater1 (please see code in earlier posting).

We cause an error, by removing the network cable during various times in the update.

We put back in the network cable to restore internet connectivity.

We click the "Update Now" button in our custom dialog, which then calls automaticUpdater1 again.

Sometimes the update works and sometimes it hangs or fails.

The results vary, with different errors at different times. Please see errors noted in earlier posting.

Sometimes the download and update succeeds, sometimes it fails.

Sometimes, the automaticUpdater_ProgressChanged event starts at a high percent immediately, such as 94%, and it says "extracting" so it seems that the wyu file is downloaded, and it's in the extraction phase.

Other times the update does nothing, i.e. it seems to hang, or perhaps it's in a long timeout.

Other times the update works fine.

What we would like to know is:

1. What does automaticUpdater/wyUpdate do to handle error recovery?

2. What should we do to best handle and recover from update errors?

3. Is there a way to reinitialize automaticUpdater/wyUpdate so that the user is not presented with errors, i.e. the process starts completely over again? 4. Would automaticUpdater.Cancel in the error events make the process start completely over again?

Sometimes, the automaticUpdater_ProgressChanged event starts at a high percent immediately, such as 94%, and it says "extracting" so it seems that the wyu file is downloaded, and it's in the extraction phase.

I'll try to reproduce this bad behavior, but it would be better if you gave me one example that you could repeat consistently.

1. What does automaticUpdater/wyUpdate do to handle error recovery?

When the AutomaticUpdater fails it goes to the last successful step. When wyUpdate fails it rollsback your update to the last version.

2. What should we do to best handle and recover from update errors?

Let wyUpdate handle it.

3. Is there a way to reinitialize automaticUpdater/wyUpdate so that the user is not presented with errors, i.e. the process starts completely over again?

No. wyUpdate / the AutomaticUpdater already go back to the last successful step.

4. Would automaticUpdater.Cancel in the error events make the process start completely over again?

No.