[wpkg-users] wpkg.js crashing?

Brian May brian at vpac.org
Mon Apr 21 01:03:17 CEST 2008


Rainer Meier wrote:
> And let me repeat again... WPKG does not seem to crash for you. Most 
> probably just the API call is hanging. So it is useless trying to catch 
> an exception if there is simply no exception thrown by Windows on the 
> logEvent() call.

Let me repeat again: Yes it does. If the API was just hanging, then the 
process would still be running. It is not still running. I think I told 
you this already.

If it was a matter of nothing being logged and the process continuing, 
then I would expect to see the applications installed regardless.

So the process definitely is exiting prematurely, that is without 
completing the tasks it was required to perform. I call this  "crashing".

In fact I think I can guess why it is crashing, if this is the code you 
talked about:

try {
         main();
} catch (e) {
         error("Message:      " + e.message + "\n" +
                         "Description:  " + e.description + "\n" +
                         "Error number: " + hex(e.number) + "\n" +
                         "Stack:        " + e.stack  + "\n" +
                         "Line:         " + e.lineNumber + "\n"
                         );
         notifyUserFail();
         exit(2);
}

Here if any exception occurs, error is called which tries to log a 
message via the log function. However I just established that the the 
log function probably causes an exception when trying to write to the 
event handler - Guess what - it will cause an exception again when 
trying to log the fact that the previous log attempt failed - there is 
nothing to catch this exception - the result being the application WILL 
die without any errors being displayed.

Meanwhile, the log file is perfectly OK, but not getting used, because 
it isn't tried until after the message is logged to the event handler.

Ideally if an exception occurs when logging to the event handler it 
should still try writing a message to the log file. This means wrapping 
the code that logs to the event handler in a try ... catch clause, 
otherwise the log function will abort before it gets a chance to log to 
the log file.

Brian May




More information about the wpkg-users mailing list