I can’t seem to trap this UnhandledException, which kills (locks-up) my App and doesn’t break to show me an error.
Symptom: App runs consistently w/out issues, then ‘hangs’ and forces me to close it in the IDE. The App runs for 10-20 minutes, repeatedly and successfully using the dbase.
The MySQLCommunity dbase is running fine, and my other Apps never have an issue. So I rem’d out all dbase activity in the app and tried to slowly reintroduce segments of code. It seems that even the simplest Select statement runs many times, but then ‘something’ in relation to the dbase interaction locks up the app. If I remove the dbase segment again the app runs all day w/out issue.
Is there any way to track down this issue? (Xojo 2024 R4.2), the App is a WebApplication.
I’ve run in to hard crashes without an exception like that and the culprit ended up being a database connection, which was saved as a property, being used simultaneously by 2 separate threads.
That would be something to check for.
Hi Jared,
So, I’m using threads to poll a dbase, and if records are returned that meet certain conditions then I process them accordingly - pretty standard stuff.
I’m creating a new instance of the dbase connection at the top of Thread, using it in the scope of the Thread, and then closing the connection at the bottom of the Thread, then Sleeping the thread for a period to awake and do it all over again.
I’ve left breadcrumbs throughout the Thread’s (run) method to write to the debug console to see if there’s ever a consistent spot that hangs the app, based on the code in the Thread, but don’t find anything bad or offensive in the code.
Are there cautions about Threads and dbase polling that I might be overlooking?
It sounds like you should be fine from that perspective since you’re creating a new connection that is only used by that thread.
You could try using a timer to run the thread instead of sleeping it so that you get a fresh run through each time.
I don’t think that would make a difference, but it’s something worth trying.