Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 3 Monaten
Letzter Beitrag:
vor 1 Jahr, 3 Monaten
Beteiligte Autoren:
Yaku, Stefano Giavardi, Fabrice Harari

[WD20 - MySQL] App hanging prevention

Startbeitrag von Yaku am 10.04.2017 14:23

Hi everyone,
I have an application that's connected to a MySQL database via Native Access.
Whenever there's a loss of connection to that DB, and everytime the application tries to run a query, the app freezes.
More often than not, the classic "app.exe has stopped working" window appears when I, pretending to be a customer, click several times on the hanging screen.
What i want to do is to prevent that, dodging the freezing app issue, while showing the customer a message like "Can't connect to the database. Try again later".
Do you know how i can achieve that?

p.s.: I have no sufficient rights to modify the DB properties.



logically, you should be able to trap the original loss of connection error with a "when exception" statement...

at that point, you should be able to run a re-connect code containing whatever you want...

Best regards

von Fabrice Harari - am 10.04.2017 14:38
Hi Fabrice,
Thank you for your quick reply.
I've tried that, and it works... but only after about 20 seconds.
That 20 seconds is where the application hangs. It seems that, in that timeframe, the application tries to stubbornly reconnects, preventing all other actions.
One option that i thought of is to include every single communication with the DB (queries and whatnot) in a separate thread, but sadly that isn't feasible...

von Yaku - am 10.04.2017 16:00
The worst is that during that 20 seconds if the final user click on the screen the application hangs and windows says "the program has stop running" while the window is opaque (like a disabled window).

Maybe a sure solution could be doing all queries inside threads but "one query - one thread" (in order to keep the main thread free and the interface smooth) is not exactly a handy solution for the developer...

von Stefano Giavardi - am 10.04.2017 16:36
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.