WebApp Stops Sending Push Data To Browser

Hello everyone,

I have been trying to track down an issue where randomly my web app will stop pushing data to browsers. Usually, about every 10 seconds it will start a long poll request allowing the server to respond at any time. My app needs to update the client with data dynamically. Without this push ability, it shows nothing until you click on a button or something that sends a new request. At which time all the data is updated.

I’m not sure what is causing it but only a restart of the app fixes it, reloading the page does nothing.

Any help would be much appreciated.

Thanks!

You don’t reported many details on how data are pushed to the client.
Start checking if you are tracking correctly the session related to the client and if the data are pushed in the session context.

Regards.

I am using the built-in method of sending data to the client. For instance, I have a listbox with chat in it, this is set with ListBox.AddRow from a Shell.DataAvailable event. I know this event is happening because it also logs to a file.

Like Maurizio suggested, I wouldn’t be surprised if the Shell.DataAvailable event fires from the main thread and therefore isn’t aware of the session context, maybe @Greg O’Lone can confirm?

If so, make a subclass of Shell and add a WebSession property to it that you can set when first created, and then set a WebSessionContext early in the DataAvailable event.

So yes, She’ll.DataAvailable fires on the main thread, and yes, it won’t know which session it should be sending to (unless you’re sending to all of them by loopholes no through them on the app class). But in that case you’d be getting exceptions.

@Alex Bombay — it would be helpful to get an idea of your code Path from DataAvailable to when the listbox.addrow is called.

I jumped back on the horse and have decided to take another stab at this issue.

It only seems to appear after an exception happens.

This one was the latest one to cause the issue.

ERROR: NilObjectException

STACK:

RaiseNilObjectException:82697B34 WebSession._CreateResponse%o<WebResponse>%o<WebSession>:00616369 WebPushHandler.Respond%%o<WebPushHandler>:0075204A WebPushHandler.CheckForChanges%%o<WebPushHandler>:00751367 WebPushHandler.!Tickle:00755C28 _SessionShutdownThread.Event_Run%%o<_SessionShutdownThread>:00607D6F :826A632F :826A8CB9

This stack trace looks familiar with me. Unfortunately, I couldn’t yet track it down what causes this. There are feedback cases <https://xojo.com/issue/41892> and <https://xojo.com/issue/35187> about it. Greg was guessing we are referring a no longer existing control, but I couldn’t find such. For us, such a crash happens regularly but only about once a month at present, and I haven’t found a way to reproduce it, yet.

[quote=376092:@Alex Bombay]It only seems to appear after an exception happens.
This one was the latest one to cause the issue.[/quote]
Did you catch the Exception in Session or App? Anyhow, after that happens its unlikely, the session would survive, so I’d expect the client (browser) to display the “gone-offline” message and not freezing / stopping updates only.

Its caught in App.UnhandledException

It does come up with the built-in browser error message pane. But after that, the program doesn’t quite work as expected (doesn’t respond to push requests unless triggered by a user action) even after reloading the page. Only a restart of the app will fix it.

It seems like after the exception, the browser just “forgets” how to reply to the browser unless the browser does something like clicking a button or resize the screen.

[quote=376103:@Alex Bombay]Its caught in App.UnhandledException

It does come up with the built-in browser error message pane. But after that, the program doesn’t quite work as expected (doesn’t respond to push requests unless triggered by a user action) even after reloading the page. Only a restart of the app will fix it.

It seems like after the exception, the browser just “forgets” how to reply to the browser unless the browser does something like clicking a button or resize the screen.[/quote]
That doesn’t surprise me. Getting an exception there could definitely cause things to get unstable.