Web app freezes when unused for some time

I have a deployed web app live in the internet (cgi, linux, mysql community server) and so far it has been working fine with some users connected and is handling a database of 500+ students. The client and developing computers are iMacs 2014 with Yosemite.
It is being developed on Xojo Mac 2015R3. The site has SSL enabled so the access is thru https.

The problem in this case is that if the app is left for about 20 minutes (am trying to determine the exact period), it becomes unresponsive. It does not crash or give any message, just stops responding to the users input. No data is lost. The menu bar shows the button pressed visual effect, but the app just don’t respond.
Other users keep working normally, but the problem happens in any of the 7-8 macs connected to it.
At this time am deploying a new version where I marked it as final deployment instead of debug, but don’t know if this has any effect on the problem.
From what I see if the screen saver has been active for some time, the problem happens too.

I assume that if the web app stops or quits it shows some sort of screen, but in this case it just stops responding. Close the browser, reopen it, browse to the app.

Is there any sleep, stop, or similar setting I should be aware of?

As additional info… I left the computer with screen saver on for 10 minutes, moved the mouse and entered the password. The web app was still in the browser, but it is unresponsive.
With SSH I can see that the linux process is still on. (only one user, me, connected at this time).

Now, what is unresponsive?
The page where I left the app has buttons, web links, toolbar, checkboxes and a listbox.
The link does take me to the intended page, a php script, opens in a new window as I did set it.
The listbox scrollbars respond and it changes color when I click on a cell, but the programmed action event is not fired when it should, on clicked cell.
The checkboxes change when I click on them.
A search box and text fields can be written in, and they show the cue text when become empty.
The buttons and menu bar do show the pressing animation and return to an unpressed state but do not trigger their action events.

Because the events are not triggered, the application does not work, it is unresponsive, even though it didn’t crashed or show some error message.

Newer OS X builds do a lot of app napping. If your browser is “paused” its no longer sending data back/forth to the web server. Eventually the session will be cleaned up by the server and none of your interactions will work until you reload the app.

Just to clarify does this happen on Windows machines without app napping? If you “reload/refresh” the browser does the app come right up?

Hi Julio,

I use SQL community as well.
Can I assume you create the connection in the SESSION and you leave it open?

If you do have a look at the timeout for the SQL server, it may be 20 minutes.
All of my select and execute commands are feed through the two methods rather than doing it all over the app, so for me it is simple but you may have to try to trace many lines.

basically it is like this

r=dbase.sqlselect (“select * from here where there=1”)
if dbase.ErrorMessage = “MySQL server has gone away” then
reconnect
r=dbase.sqlselect (“select * from here where there=1”)
end if

From memory it is error 2009 but dont hold me to that.

hope it helps

damon

I’d like to know if the web app server is a Mac. If it is, it could also be suffering from the App Nap thing.

Hi Guys thanks for your answers.

I detected that the Mac computers indeed went to sleep with the screensaver, and when they wake up, the app is frozen as described. If the user clicks on refresh page on Safari, the app goes to its login page as if were just starting. There is no error, no data loss. The problem is not related to the database connection as far as I can tell.

Greg, The server is OpenLightspeed Linux. It does not nap, and I tested it by doing active querying and using the app in other machines while the frozen ones are, well, frozen.

Damon, every db connection is opened when needed and closed immediately, no connection is left opened. When the user clicks on some button, connects, gets data and closes, of course leaving info in the page for visual display. Tried what you say by adding a button with an action, but when the web app freezes like I described, no action event is triggered, so the button does nothing.

Phillip, I have not users with Windows machines, so I can’t test there right now but will try from home tonight on a PC. The only PCs at work are windows tablets with visual studio and delphi desktop apps that connect via socket, and they don’t use Xojo apps or Xojo web apps. Actually could try with them but I installed my windows explorer replacement dedicated for our system, so they don’t use windows normally and is a bit complicated to remove the custom software just for this test.

I think the problem would be solved if the Xojo web app refreshed itself back to the start page when this happens, but still am researching how to do that.

Additional info after some tests.
It does the same on windows and OS X, and the problem definitely happens when the computer goes to sleep. It only happens when the app is not on the initial page. If it is on the initial page when the computer goes to sleep, when the computer wakes up the disconnect message appears (“the application has gone offline…”). I checked on safari, chrome, firefox and IE. In windows, 7, 8.1 and OS X yosemite and El capitan.

Interestingly, discovered a method of “reviving” the app by opening the browsers developer javascript debugger, but I can not tell my client to do that sloppy solution.

Tested the Eddies Electronics sample but since that app is in the starting page at all times, it does not seem to freeze.

Currently am testing a concept to revive it via javascript, but I think this behavior seems a bit like a Xojo’s bug, or am missing some procedure…

Eddies Electronics is using SQLite so to me that would lead me to ask if the MySQL connection has timed out in your application and you’re not handling it.

I don’t think so. In my app, the Mysql db connection is opened and immediately closed after selecting or updating. It does not keep any connection opened.

I think you may be running into the lost session issue that I also am fighting. Sometimes when a session times out I get the proper error message. But if anything happens to interrupt the browser, like the screen saver coming on, or if you’re on an iPhone you lock the screen or switch to another app, it never gets the message and just sits there. It looks like it’s active, and you can click all your want but nothing ever happens.

In my case if the browser is active when the session times out I get the message properly, but if the javascript on the client is somehow paused when the timeout happens then no errors are displayed at all when it tries to reconnect. On the iPhone I can see the spinning indicator that says it’s making network traffic so I know it’s running locally.

I have been bugging Greg about this in another thread. The javascript framework really should bring up the disconnected message, or better yet bring up a dialog with a button to reload and start over. But it currently does not respond in any way to the connections being refused by the server.

Or yours may be a totally different problem :wink: But it sounds like it to me.