Internal Server Error because app won't quit

I have 9 different cgi apps that get loaded in frames on our site. All do different things like look up chapter information, show committee members etc.

One brings up our members information (Member Edit) that we have in our members database so they can correct any errors. This app is used the most as it’s the first thing a user sees when they log in.

In all the apps I have the following code:

App Open Event:

App.AutoQuit = True
App.Timeout = 1
App.SessionTimeout = 1

Session open event:

Self.Timeout = 30

Session Timeout event:

Self.Quit

Here’s the test app: https://dl.dropboxusercontent.com/u/125593/RSATestApp.xojobinaryproject

Now it does seem to work partly in that the apps do quit and remove them selfs from memory.

However when they do not get released from memory, then cause the internal server error.

One This seems to have been the most work is the member edit which of course is the one use the most. Now from my research I have seen people say that if there is any reference to the session that the session will never quit. Now I do have a MySQL database object is a property of the session. Is this something that could be keeping the session open?

What would be the proper way to release the object?

Is there something else I can do to ensure that the app eventually closes and releases the memory, therefore stopping the internal server error?

Thanks for any help!

uh… why are you quitting the app? Why not just close the user’s session?

Greg,

I guess the answer to that is using really quits but closes the page moves to a new page. The only reason Thompson quit the app is because when someone gets the internal server error and I look at the running processes the app is running. Terminating the act solves the internal server error.

Also it’s very possible user will just leave the window open and go on to some other application.

Is there a reliable way to determine if the user closes the tablet contains the act or the user moves away from the page?

The session will close if the browser is unresponsive for 3 minutes, but I still think your issue is in the fact that you’re quitting the app. That will disconnect all users that are currently connected. You should probably be using Session.Close.

Are you referring to Self.Quit in Session Timeout event?

I don’t see a Session.Close

@Richard

You should be able to add event to session and in the list will be close

@brian franco I’m sorry you lost me.

@Richard

In the IDE if you right click on session you will see the menu “Add to session” and then you can choose “Event Handler” or left click on session and in the IDE window menu select Insert, either way you choose you will be able to add the close event to session as Greg mentioned, it is not there by default.

@brian franco
Doesn’t the Close event fire when the session closes? It’s not a method to close it.

@Greg O’Lone
said I should close the session not quit it.

I shouldn’t read on my small phone…either that or it’s time for a checkup at LensCrafters!

Sorry Richard for some reason I was thinking you needed to handle some stuff when a users session was closing

Age sucks!

[quote=228094:@Richard Albrecht]Are you referring to Self.Quit in Session Timeout event?

I don’t see a Session.Close[/quote]
Yeah, that’s it. I keep forgetting that the method is Quit, but the event is Close. I always associate Quit with leaving the app entirely.

Just make sure you’re calling the Session version of Quit, not the one on App.

In the code above I have Self.quit in the Session Timeout. But they still hang. What should I look for?

In that Session.Timeout event, try using ShowUrl to redirect the user away from the app. You can even use the /special url and return a generic html page, just to let the session die off.

I’d also like to suggest that you set App.SessionTimeout to a larger value. The industry standard is 3 minutes (180 seconds). Setting it to 1 second will likely cause the server to disconnect sessions unexpectedly. Try commenting out that line or setting,it to 180 and see if that makes the issue better.

What’s the difference between App.SesionTimeout and session.Timeout?

App.SessionTimout is the number of seconds after the last communication from the browser that the app will close down the Session. Basically, there’s no way to definitively know that a user has left your app except for the fact that we’re not receiving any communication from the browser.

Session.Timeout sets up a client side timer which looks for mouse and key events. If the time that you’ve set passes without user activity, a message is sent to the server and the Session.TimedOut event will fire. It was designed to allow you to create an effect like the banking websites do so that when a user walks away from their browser, you can automatically log them out.

Alright here’s some more info:

I put the showurl in the session timeout as suggested.
I Launched my test app in one tab. About 5 seconds later Launched it in a second tab, I closed one tab and the other tab timed out.
The app remained in Memory when I checked around 20 minutes later. This is what I need to solve.

This is an output of all the events and the order they fired:
11/11/2015 11:26:00 AM - In App Open
11/11/2015 11:26:04 AM - Session Open
11/11/2015 11:26:04 AM - WebPage Open
11/11/2015 11:26:04 AM - WebPage Shown
11/11/2015 11:26:11 AM - Session Open
11/11/2015 11:26:11 AM - WebPage Open
11/11/2015 11:26:11 AM - WebPage Shown
11/11/2015 11:26:51 AM - Session Timeout
11/11/2015 11:26:51 AM - WebPage Close
11/11/2015 11:26:51 AM - Session Close

Here’s a link to the current project: https://dl.dropboxusercontent.com/u/125593/WontQuit.xojo_binary_project

Launched it again, without terminating the previous launch that was still in memory. After that one timed out it was still in memory and it still shows the original starting time of 11:26.

Could this possibly be a bug? Using 2015 2.4