Page 1 of 1

Auto Sync not terminating

Posted: Fri Apr 07, 2006 10:31 am
by gsouders
Hi Support,

I have uncovered a nasty problem with the Auto sync Function. On several occasions I have discovered my clients Auto Sync scheduled task still running. The task runs at 12:30 AM every night. I have found it still running then next day 12 hours later. The task normally takes 5-10 minutes. It took some experimenting but I have figured out why this is occuring.

The problem occurs when the task is run and the source or target PST is opened and locked by Outlook. The other criteria is that the account that is running the AutoSync is currently not logged on. This is always the case on my clients machine because the scheduled task is run from the Administrator account which is never logged on when the task is run.

Here is were it gets interesting. If the machine is logged on to the Administrator account when the scheduled task is run, then two error messages are displayed informing the user of the problem. I should mention that the second error message is different when generated from a manual sync. Here are the messages generated from a manual and autosync when the PST is locked.

Manual Sync
__________

First Message - Properties for this information service must be defined
prior to use.

Second Message - Mapi Error : 80040119
The file <Path>Outlook.pst is in use and could not be
accessed. Close any application that is using the file,
and try again.

Auto Sync
________

First Message - Properties for this information service must be defined
prior to use.

Second Message - Error : Access Violation at 0x7C8024E5 (tried to write
to 0x00030E3C), program terminated.

If you notice the second message generated when running as a scheduled
task is an Access Violation. When you click ok on the second error message the scheduled task does terminate with an error condition. This is good but the message should be the same as a manual sync. It should not cause an Access Violation.

I have showed one way that the scheduled task does not terminate. I suspect that other conditions will yield the same result. For instance if the network is down when the task in run, the PST on the other machine will not be able to be opened. Again if not logged on then the task will hang indefinately because it is waiting on user input (i.e. clicking on the OK button from the error message).

This problem can become very nasty if it goes undetected. The default setting for a scheduled task is to terminate if running for 72 hours. If the task is set to run every 24 hours then you will have 3 Auto Sync's that are hung up running at the same time. The other nasty is that one of the PST's will be locked by the Auto Sync task. This means that when the user tries to access email through Outlook on the machine that has the PST locked, they will not be able to.

So here is the botom line. The program needs to check if it is running in interactive or scheduled mode. If running in interactive mode then generate the error messages to the screen. If running as a scheduled task then do not generate error messages to the screen as the account running the task may not be logged on to receive them. Instead terminate the scheduled task with an exit code. The exit codes should reflect the error condition that has occurred. This way you can check the task scheduler log file to see what problems might of occurred. The exit codes should be described in the documentation. They should be added to help file so the user can reference the meaning of the codes.

I hope this problem will be addressed as soon as possible. Please let me no if further explanation is required. Thank you for your support...