CallLater / App.Quit not always working

Ah I didn’t know you’re using xojoscript. Are your HTTP Sockets sync or async? Are you starting the sockets in xojoscript? Loops in xojoscript won’t yield time on loop boundaries to threads outside xojoscript unless you have app.doevents in the xojoscript.

The only time I’ve been able to stop the quit of my test console app so far is when I trap EndException or ThreadEndException and don’t re-raise them or block the app with a long running xojoscript. If I block during the xojoscript, no timers fire, even basic timers no matter if they’re in the base or in threads so it can’t be that if you still have timers firing.

I really think the little demo will be key here to figure out how you have things in a state where some timers run and others don’t.

They’re async. Thanks for your input! My scripts / loops / threads yield plenty of time as they are all running in parallel non-stop without issues.

I sometimes (?) get the EndException error too (and re-raise as per manual) so no probs there, but in this case it’s a non issue anyway, as the quit method isn’t even logging itself - which is the first line of code in there.

Cheers!

Follow up: App.Quit() also doesn’t do a thing in this case. A quick reminder…

Result: method gets called because the counter works. Here’s the brilliant method…

MessageAdd(CurrentMethodName) App.Quit()

Here’s my log…

[quote]010847 (+3) ACT.QuitApp
010847 (+2) App shutdown: 0.9.0.1144

010852 (>999) ACT.timerShutdownAction: QuitAppScheduled increased.
010857 (>999) ACT.timerShutdownAction: QuitAppScheduled increased.
010902 (>999) ACT.timerShutdownAction: QuitAppScheduled increased.
010907 (>999) ACT.timerShutdownAction: QuitAppScheduled increased.
010912 (>999) ACT.timerShutdownAction: QuitAppScheduled increased.
…[/quote]

The ‘App shutdown’ part is logged by the ‘Stop’ event handler. So that piece works. But as you can see the the app happily continues to update my counter as before (which is the only thing left for it to do by the way). Forever. No exceptions. No quitting gracefully.

So, is there another way to force-quit an app from code? Or should I call some sort of kill script?

[quote=484303:@James Dooley]I don’t see anything in your code setting this property to False:

https://documentation.xojo.com/api/web/webapplication.html#webapplication-acceptingconnections[/quote]

Added this one too. Although it appears to close the open sockets (I still need to double check), it doesn’t help the shutdown unfortunately.