Sessions not quitting

I have noticed there has been a number of discussions on session not quitting however I am also having this problem but it seem to be an out side source.

I have put a list on the management page of my app, that lists sessions so I can see who is logging in and for how long etc. When Google’s ip 66.249.85.252 (I’m assuming this is a Google Bot) hits my app, their session does not quit & all other sessions after that will not quit.

After looking at the error logs on the server, it seems that their IP address does not appear, however there are a string of other IP addresses that are trying to go to my IP where my app is.

My app is not being used at this point so the traffic to it is myself & a couple of others testing.

Is there a way that I can stop these sessions from freezing? Why as users, can we not write a force quit routine?

I have not seen anyone mention that sessions from web crawling apps like Google could be causing this problem. Hopefully someone out there may be able to shed some light on this.

Also at the time of writing this post the session from Google has been up for over 30mins.

Thanks in advance

Chris

Ps I am not discounting that it’s some thing I have done…

Hi All

Can any help with this.

Hi Chris - I’ve seen the sessions not quitting problem but not exactly like this. Can you send me a project (jason@xojo.com) that I can deploy here?

[quote=277721:@Chris Percival]I have not seen anyone mention that sessions from web crawling apps like Google could be causing this problem. Hopefully someone out there may be able to shed some light on this.
[/quote]
This is the first time I’ve heard of something like this. The only way I can see this as being possible is if:

  1. Google now supports JavaScript
  2. Google now supports Ajax apps
  3. Google is simulating mouse and/or keyboard events

I guess if the first two were true and you had a WebTimer which continually downloaded new content, that might keep the session going too.

Can you confirm if the Google bot is still connected?

Hi Jason & Greg

As far as I can tell the Google bot is hitting the App for a moment and causing a session to start.

I have an Admin page, to manage the clients, that has a WebTimer that refreshes 3 lists, one of which is a list of sessions. This runs every 10 sec’s. I’m guessing this is only running when I’m logged on as an administrator and that page is open.

I also write to a text file, which is saving in the documents folder on the server, when a session is opened and closed.

This the code for the list box…

SessionListBox.DeleteAllRows

Dim cnt As Integer
dim psUpTime As String

dim miNumberOfSessions As Integer
miNumberOfSessions = App.SessionCount

For i As Integer = 0 To App.SessionCount -1

DIM s AS Session = App.SessionAtIndex(i)
Try
  psUpTime = App.SessionUpTime(s.spsSessionOpenOn)
Catch e As RuntimeException
  psUpTime = "No open date"
End Try

SessionListBox.addRow(IF(Session is s, "(C)", ""), s.spsWelcomeNameConact, s.spsDataFileNumber, psUpTime, s.RemoteAddress, s.Header("Connection"), s.Identifier)
SessionListBox.RowTag(cnt) = i
cnt = cnt + 1

Next

SessionListBox.Heading(0) = “C”
SessionListBox.Heading(1) = “Contact”
SessionListBox.Heading(2) = “DatafileNumber”
SessionListBox.Heading(3) = “Up Time”
SessionListBox.Heading(4) = “IP Address”
SessionListBox.Heading(5) = “Connection”
SessionListBox.Heading(6) = “SessionID”

SessionListBox.ColumnWidths = “30, 160, 170, 120, 100, 90, 360”

This the code for the open session…

Dim tos As TextOutputStream

If App.WIBSessionLogFile.Exists Then
tos = TextOutputStream.Append(App.WIBSessionLogFile)
Else
tos = TextOutputStream.Create(App.WIBSessionLogFile)
End If

dim msSession As String
msSession = Self.RemoteAddress+ " - " + Self.Header(“Connection”) + " - " + Self.Identifier

Dim d As New Date
d.GMTOffset = Self.GMTOffset

tos.WriteLine(d.ShortDate + Chr(9) + d.LongTime + Chr(9) + msSession)
tos.Close

This the code for the close session…

If App.WIBSessionLogFile.Exists Then
tos = TextOutputStream.Append(App.WIBSessionLogFile)
Else
tos = TextOutputStream.Create(App.WIBSessionLogFile)
End If

dim msSession As String
msSession = Self.RemoteAddress+ " - Closed - " + Self.Identifier

Dim d As New Date
d.GMTOffset = Self.GMTOffset
tos.WriteLine(d.ShortDate + Chr(9) + d.LongTime + Chr(9) + msSession)
tos.Close

Hi Guys

Just have had Google back with IP 66.102.7.166. Its about the same time as last night.

ARIN WHOIS data and services are subject to the Terms of Use

available at: https://www.arin.net/whois_tou.html

If you see inaccuracies in the results, please report at

https://www.arin.net/public/whoisinaccuracy/index.xhtml

The following results may also be obtained via:

https://whois.arin.net/rest/nets;q=66.102.7.166?showDetails=true&showARIN=false&showNonArinTopLevelNet=false&ext=netref2

NetRange: 66.102.0.0 - 66.102.15.255
CIDR: 66.102.0.0/20
NetName: GOOGLE
NetHandle: NET-66-102-0-0-1
Parent: NET66 (NET-66-0-0-0-0)
NetType: Direct Allocation
OriginAS:
Organization: Google Inc. (GOGL)
RegDate: 2002-07-03
Updated: 2012-06-19
Ref: https://whois.arin.net/rest/net/NET-66-102-0-0-1

Well, you could write some code in HandleUrl to intercept these and prevent a session from being created.

Just out of curiosity, what is on the page that Google is hitting?

Hi Greg

I don’t know how far it gets, however I have a startup page like your demo in “Eddies Electronics” which redirects to a login dialog & then on to the budget page.

I have now added a text property to record what’s happening as the code runs up to the login dialog & hopefully this may give us some more clues .

At this moment I still cannot deploy the App as the server has not been reset from when it crashed last night (my time). I get an ‘You don’t have permission to access /WIB-Dev/index.cgi on this server. Apache/2.2.15 (CentOS) Server at 119.9.130.121 Port 80’ error.

When the server is back up I will deploy the App and try again…

Thanks Chris

Given how new I am to Xojo, you might want to take this with a grain of salt, but I found the following in my case of stuck sessions:

I have an Admin page that, among other things, lets me see how many sessions are active (App.SessionCount). Whenever I was done with that page, I would hit a button (Session.Quit) that killed that session so as not to unnecessarily contribute to the Session Count. After a while I noticed that Session Count no longer decreased, and the only solution was to kill the app.

Once I stopped issuing Session.Quit anywhere in the app (not in my Admin page, not in TimedOut, etc.), this problem went away. I have never seen a session fail to die by natural causes since then, letting the framework kill them with its default logic.

Thanks Ralph, Jason & Greg have been great help. I will post the findings so everyone can benefit.