Web appli crash without information

Appli CGI on MacOS 10.10, Xojo 2015r22

This appli has two windows : one for type an order number, and one with the list of the products in this order, to scan these products
When the scan is finish, the appli comes back to the first window, etc

Sometimes, the CGI crashes, without any information, cf : http://www.marinelabel.com/Xopic/WebCrash.png
It’s always when the program closes the first window to show the second

In debug mode, I’ve never seen so a crash, but in real-CGI mode, it occurs every 3 or 4 orders

How to find the issue ?

Implement the JavascriptError event on the Session class and then make sure you press Send on that e error info will be shown there.

We had to hide the exception data on phones because the screen is so small.

I have already this in Session. JavascriptError :

MsgBox ErrorMessage + EndOfLine + UserDetails

and nothing appeared

Hi Greg, what should I place in Session. JavascriptError ?
Thanks
Marc

What you can do is access the app from a computer, then you get a much larger JavaScript error message that will list the error and the code that triggered it. Then you can select and copy it for further analysis. It is convenient since you get immediately the information.

Otherwise here is an example of code in JavaScript error :

Function JavaScriptError(ErrorMessage As String, UserDetails As String) As Boolean system.DebugLog ErrorMessage+EndOfLine+Userdetails End Function

Click Send at the bottom of the black error box, and everything will be sent to the console. Your first post is unclear as if the app is hosted on your OS X machine or elsewhere. On a host, you will probably find that information in the logs.

ok I will do that, thx

just a question : in this webappli, two WebPages are showed alternately
should I .close the first when I .show the second ?
or just .show the second (and keep the other in memory) ?

Marc

[quote=201053:@Marc Couraud]ok I will do that, thx

just a question : in this webappli, two WebPages are showed alternately
should I .close the first when I .show the second ?
or just .show the second (and keep the other in memory) ?
[/quote]

I do not think the amount of memory is such that you need to close the other one. I would gather that keeping it in memory will display it faster when it comes back.

That said, I wonder about that :

[quote=200912:@Marc Couraud]Sometimes, the CGI crashes, without any information, cf : http://www.marinelabel.com/Xopic/WebCrash.png
It’s always when the program closes the first window to show the second[/quote]

You should make sure the second page is finished displaying before closing the first one. I would do that in Shown rather than Open.

Actually, page 1 is never closed, and page 2 is closed by a “Self.Close” at the end of her process
and the page 1 is again shown automatically, as the page 2 is closed

what’s your opinion?

Keep in mind that if you don’t close Page1, the data on it is still technically available to the user if they decide to go poking around.

FWIW, it’s certainly possible that nothing is being transmitted to the JavascriptError event. That Event won’t fire if the app crashes first. Make sure you have code logging code in Session.UnhandledException and in App.UnhandledException and that they return True if it’s a condition that you think you can recover from without the browser being out of sync with your app.

I added system.DebugLog “PrepaCol Session.UnhandledException(or other):” ErrorMessage+EndOfLine+Userdetails in :
Session. JavascriptError, Session.UnhandledException and in App.UnhandledException

When the webapp “PrepaCol” crashes, I just get this line :
20/07/2015 09:08:10,312 PrepaCol[423] PrepaCol Session.UnhandledException: 0

Searching “PrepaCol” in the logs, I find this :
20/07/2015 09:04:39,837 PrepaCol[382] WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.3 instead of 10.10.3. Use NSProcessInfo’s operatingSystemVersion property to get correct system version number.
Call location:
20/07/2015 09:04:39,838 PrepaCol[382] 0 CarbonCore 0x93063291 ___Gestalt_SystemVersion_block_invoke + 135
20/07/2015 09:04:39,838 PrepaCol[382] 1 libdispatch.dylib 0x93c810b5 dispatch_once_f + 251
20/07/2015 09:04:39,838 PrepaCol[382] 2 libdispatch.dylib 0x93c820d8 dispatch_once + 31
20/07/2015 09:04:39,838 PrepaCol[382] 3 CarbonCore 0x92fdc69d _Gestalt_SystemVersion + 1050
20/07/2015 09:04:39,838 PrepaCol[382] 4 CarbonCore 0x92fdb7c0 Gestalt + 150
20/07/2015 09:04:39,838 PrepaCol[382] 5 rbframework.dylib 0x007db5c3 _Z11InitGlobalsv + 43
20/07/2015 09:04:39,838 PrepaCol[382] 6 rbframework.dylib 0x007b15b5 SSToStringSetter + 125
Is it important ?

[quote=201467:@Marc Couraud]
When the webapp “PrepaCol” crashes, I just get this line :
20/07/2015 09:08:10,312 PrepaCol[423] PrepaCol Session.UnhandledException: 0[/quote]
What’s in the log just after this line?

20/07/2015 09:08:03,325 com.apple.xpc.launchd[1] (com.apple.TrustEvaluationAgent) This key does not do anything: OnDemand
20/07/2015 09:08:10,312 PrepaCol[423] PrepaCol Session.UnhandledException: 0
20/07/2015 09:10:17,257 Console[480] Failed to connect (_consoleX) outlet from (NSApplication) to (ConsoleX): missing setter or instance variable
20/07/2015 09:10:17,571 SubmitDiagInfo[344] Couldn’t load config file from on-disk location. Falling back to default location. Reason: Won’t serialize in _readDictionaryFromJSONData due to nil object
20/07/2015 09:15:05,011 Console[929] Failed to connect (_consoleX) outlet from (NSApplication) to (ConsoleX): missing setter or instance variable

[quote=201481:@Marc Couraud]20/07/2015 09:08:03,325 com.apple.xpc.launchd[1] (com.apple.TrustEvaluationAgent) This key does not do anything: OnDemand
20/07/2015 09:08:10,312 PrepaCol[423] PrepaCol Session.UnhandledException: 0
20/07/2015 09:10:17,257 Console[480] Failed to connect (_consoleX) outlet from (NSApplication) to (ConsoleX): missing setter or instance variable
20/07/2015 09:10:17,571 SubmitDiagInfo[344] Couldn’t load config file from on-disk location. Falling back to default location. Reason: Won’t serialize in _readDictionaryFromJSONData due to nil object
20/07/2015 09:15:05,011 Console[929] Failed to connect (_consoleX) outlet from (NSApplication) to (ConsoleX): missing setter or instance variable[/quote]
In the unhandledException events, you should output the Stack. It’ll be something like:

System.DebugLog(Join(err.stack, EndOfLine))

That should tell you where the actual error is, I just don’t remember the name of the property passed to that method and I’m not near my desk yet.

OK, done, I’m waiting for a crash

on Mac OS X we got new javascript crashes (without message in Session. JavascriptError, Session.UnhandledException or App.UnhandledException)

[quote=201485:@Marc Couraud]OK, done, I’m waiting for a crash

on Mac OS X we got new javascript crashes (without message in Session. JavascriptError, Session.UnhandledException or App.UnhandledException)

Are you putting Javascript in your Open event? If so it will cause issues. Make sure this is put in the Shown event instead.

What did you mean by “putting Javascript” ?

I’ve seen these types of errors whenever you put Javascript in the Open event even if the javascript is blank. I filed a bug report on this not too long ago and Greg reviewed it.

Usually this is done by myControl.ExecuteJavascript(myJavascript)
But there are some other ways that javascript can be sent out. Creating WebMenuItems in the open event is another way this happens. It’s best to avoid putting a lot of logic in the Open events. Unfortunately the Shown event typically isn’t a good solution either as its often “too late” and damages the user experience.

It might not hurt to check the Open events and see if any of that logic can be moved to the Shown event.

Thanks Brock, but we have no “ExecuteJavascript” in the source, nor create of WebMenuItems

An error again :
Could not execute returned javascript: Cannot read property ‘children’ of null
Source: new webcanvas(‘LOxy2lIx’,[‘GotFocus’,‘KeyPressed’,‘LostFocus’,‘MouseDown’,‘Open’,‘Shown’]);
Xojo.controls[‘LOxy2lIx’].setEnabled(true);

I just want an idea to solve this issue !
How to match these javascript errors and the code we wrote ?

[quote=201571:@Marc Couraud]Could not execute returned javascript: Cannot read property ‘children’ of null
Source: new webcanvas(‘LOxy2lIx’,[‘GotFocus’,‘KeyPressed’,‘LostFocus’,‘MouseDown’,‘Open’,‘Shown’]);
Xojo.controls[‘LOxy2lIx’].setEnabled(true);[/quote]

This is often the result of trying to get or set properties in the open event of a control.

[quote=201571:@Marc Couraud]I just want an idea to solve this issue !
How to match these javascript errors and the code we wrote ?[/quote]

One way is to list all controls on the WebPage together with the ControlID, which is used by JavaScript (LOxy2lIx). So you can see which control triggered the error.

Something like this :

For i As Integer = 0 To Self.ControlCount-1 System.debuglog(Self.ControlAtIndex(i).Name + " " + WebControl(Self.ControlAtIndex(i)).ControlID) Next

Sample output :

TextField1 MzzFF1zL Checkbox1 Pi4EJvX8 Button1 LVH0zzFV