NetTalk Central

Author Topic: SessionExpiry causing app crash  (Read 3504 times)

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
SessionExpiry causing app crash
« on: July 31, 2013, 03:52:13 AM »
NT 7.15

I have finally tracked my web server crashing to the session expiration setting. When a session expires after no activity it causes the exception shown here:

Call Stack:

 7/31/2013, 6:34:19 AM, 0:04:12,,3,Runtime error,Index out of range
Error point: 0040196C
Process PID=6556  Image: C:\CT8\Applications\Server\Web Server\cpweb_mn\cpweb_mn.exe
Thread 1  Handle=000000E0  TID=5552

I have added the code shown below to the Web Server procedure to set my own session time out:

  ! Start of "Override Default Server Settings"
  ! [Priority 5000]

    IF Global:SessionTimeOut = 0
      Global:SessionTimeOut = 30
    End
 
    ThisWebServer._SitesQueue.Defaults.SessionExpiryAfterHS = Global:SessionTimeOut * 6000 + 1 
   
  ! End of "Override Default Server Settings"
  Put(s_web._SitesQueue)

Global:SessionTimeOut is a long and can be set by the user (in minutes) but as the code shows it cannot be zero.

Is there anything wrong with my code above?

Chuck


cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: SessionExpiry causing app crash
« Reply #1 on: July 31, 2013, 04:12:09 AM »
On further testing I have found that SessionExpiry causes a crash every time from the template code also. I removed my embeds and set the Session Timeout in the Web Server procedure properties to 5 minutes - after five minutes of inactivity (after login) the app crashes every time. And always with an exception of "index out of range".

Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: SessionExpiry causing app crash
« Reply #2 on: July 31, 2013, 06:44:56 AM »
In NetWeb.clw I have traced the code to

DelSession  Routine

  RequestData.WebServer &= self
  RequestData.DataString &= null
  RequestData.RequestMethodType = NetWebServer_DELETESESSION
  RequestData.SessionId = self._SessionQueue.SessionID
 
  self.StartNewThread(RequestData)

The crash happens when StartNewThread is called. Crashes with "index out of range" exception.

Chuck

cwtart

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • CommPay Software
    • Email
Re: SessionExpiry causing app crash
« Reply #3 on: July 31, 2013, 07:23:51 AM »
The problem was caused by my own code embeded in the WebServer procedure StartNewThread procedure

  ! [Priority 3000]

IF Sub(Upper(p_RequestData.DataString[1 : p_RequestData.DataStringLen]),1,18) <> 'POST/_CHECKSTATUS?' |
    And Sub(Upper(p_RequestData.DataString[1 : p_RequestData.DataStringLen]),1,18) <> 'GET /_CHECKSTATUS?'
 Global:WebLastActivity = p_RequestData.DataString[1 : p_RequestData.DataStringLen]
 End 

    self._PerfStartThread()

I was trying to set a global variable that could be ready by my service manager app. Shot myself in the foot. Sorry for the false alarm.

Chuck

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: SessionExpiry causing app crash
« Reply #4 on: July 31, 2013, 09:31:39 PM »
at least you figured it out Chuck - that's the main thing!

cheers
Bruce