NetTalk Central

Author Topic: _SessionQueue not found update from NT 11 to 12  (Read 4672 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
_SessionQueue not found update from NT 11 to 12
« on: October 04, 2021, 02:16:52 PM »
Hi, Bruce

I am updating to NT 12 and I am finding that a method I added to NetWebServer class many NT versions ago now generates a 'not found' compiler error.  The method loops through the records of a memory table and deletes any that do not have an active SessionID.  The method is called after the parent of the GarbageCollector method is called.  The exact code with the problem:
     SELF._SessionQueue.SessionID = MemSessionID
     GET(SELF._SessionQueue,SELF._SessionQueue.SessionID)

What is the location/label of the sessionqueue used by the web server? Is there a better way to get conform a sessionId is active?

Thanks



Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: _SessionQueue not found update from NT 11 to 12
« Reply #1 on: October 04, 2021, 05:34:30 PM »
One word answer, Casey.

MAGICK

Check out the amazing new template option that does all that for you automagically. 
I yanked out my similar code for a session-based memory table and turned it over to the template.  https://www.capesoft.com/docs/NetTalk12/NetTalkWebBasic.htm#SessionTables

As for direct access... there's now a new interface.  Check netwebsessionsInterface.inc and the other netwebsessions files.

Cheers,

Jane

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: _SessionQueue not found update from NT 11 to 12
« Reply #2 on: October 05, 2021, 01:17:50 PM »
Thanks, Jane

It looks to me that all I have to do is register the existing memory tables which have a SessionID key in the Web Handler and NT will take care of the rest.  Great.

Always glad to give up non-standard code.

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: _SessionQueue not found update from NT 11 to 12
« Reply #3 on: October 22, 2021, 10:27:44 AM »
Hi,

I have replaced my session cleanup code with the new session manager template.  Great.

I am still concerned, though, that orphaned session memory table records will accumulate over time. If my installations were being restarted every day or even every week this wouldn't be an issue, but some of them run for months without a restart.  It was my orphan clean out methods that encountered the original 'not found' compiler error.

I looked through the new netwebsessions code, but couldn't get anything to work for me. So, how do I query whether a specific SessionID corresponds to an entry in the SessionQueue?

Many thanks.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: _SessionQueue not found update from NT 11 to 12
« Reply #4 on: October 24, 2021, 10:49:17 PM »
>> I am still concerned, though, that orphaned session memory table records will accumulate over time.

I am not sure what you mean by "orphaned session memory table records"?

Cheers
Bruce

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: _SessionQueue not found update from NT 11 to 12
« Reply #5 on: October 26, 2021, 03:12:58 PM »
I have several memory tables used for transactions during a session.  The my old session cleanup method and the new sessionmanager methods  finds all the  session table records that have the ending SessionID and delete them.  But if there is an error in the process some of these records become orphans.  Rare, but with thousands of sessions a day on servers running months at a time these might accumulate. A slow memory leak.

Before NT 12 I had another method that worked in the opposite direction as well.  Loop through each session memory table record, confirm that its SessionID is still in the SessionQueue, and if not delete it. Doesn't need to be done often; once a day or even one a week is more than enough. I just need a way to determine if the SessionID is in the SessionQueue.

Thanks.


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: _SessionQueue not found update from NT 11 to 12
« Reply #6 on: October 27, 2021, 09:34:08 PM »
Hi Casey,

>> But if there is an error in the process

is there?

>> Loop through each session memory table record, confirm that its SessionID is still in the SessionQueue, and if not delete it.

did it ever find anything?

Cheers
Bruce