Application not responding

sconlon

Active Member
Licensed User
Longtime User
I'm trying to track down the cause of this message ' Application not responding, would you like to close it". My app has a service module that runs every 20 secs (it resubmits itself with StartServiceAt) to scan received text messages and process relevant ones and store them in a database. It also updates a global variable declared in module Main to indicate whether or not is has inserted any new rows into the database.

An activity module polls the database and display the contents of the text messages allowing the user to print or reply to them etc. This activity uses a timer to poll the database and also checks then to ensure that the scan service is running, restarting it if not. I also have some popup menus in this activity which allows the user to config various settings.

Sometimes I get the 'Not Responding' message but though it is not fully repeatable it seems to mainly occur when I have one of the popup menu panels displayed, one that requires user input.

It doesn't seem to happen in debug mode so I can't find it that way. Could it be caused by the interaction between the display activity and the scan service module - the display activity does access some globals in the scan service but not vice-versa. The scan activity only accesses one variable in the Main module.

Ta.
 

sconlon

Active Member
Licensed User
Longtime User
Forgive my ignorance on the subject but are all the activities and services running in the main thread, I haven't deliberately started any new threads. Also, by user interaction I presume you mean something that requires a response from the user, such as a msgbox?
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Your code always runs in the main thread.

This error means that you did an operation that occupied the main thread for more than 5 seconds. The question is which operation caused this error?
No mean to interrupt, but, is this the probable cause I'm getting this type of error, in some sql handles? Occasionally I am having my sql queries (rather big list of them in a transaction) executing in more than 5 secs (even though I still refuse to accept it, since sqlite is pretty fast, but, hey, that's what I observe in some crappy devices). Wondering just if putting a doEvents inside the transaction loop, can solve this thing. It's not often, so no easy way to debug this.
 
Upvote 0

sconlon

Active Member
Licensed User
Longtime User
So the culprit operation could be in either the service or one of the activities? As mc73 asked, if I could find the piece of code that does this would a DoEvents resolve the issue?
 
Upvote 0

dieterp

Active Member
Licensed User
Longtime User
Hi Guys

I seem to be experiencing the same problem with my app. I have an activity module that starts a service that will upload data every 20 seconds. The 20 second timer only starts when I get a success message in JobDone that the last update was successful. Generally, it works without problems. Sometimes though, when I click the button to start the Service, it seems like it doesn't start the service or takes a long time to start the service, which eventually results in the 'Application not responding...' message.

I used to use 'StartService' to kick off the service, but recently started using 'CallSubDelayed', which calls a sub in the service that first checks for internet connection before doing any uploads (Thinking that may have been the issue). CallSubDelayed seems to have improved the situation, but I still get the 'Application not responding...' message sometimes.

I have put ToastMessages in to indicate when the Service is created and when it starts (And when the uploads begin). I do not see these messages appear when the problem occurs, which seems to infer that the service is not being created (Not straight away anyway). There is no other code in the activity module that could hold up the main thread for 5 seconds. It's basically just a button you push to start the service. Does anyone have any ideas for me? This is quite a big problem for me as the user also often get's a black screen to accompany the 'Application not responding...' message, which sometimes lasts for quite a while meaning they cannot continue.

Regards
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Start a new thread for your question instead of pulling out an three year old thread!

Post relevant (or maybe complete app) to the new created thread then. With the informations you provide it is hard to help.
 
Upvote 0
Top