Session variable not found

Viewed 153

for a long period of time I have an issue with Session variables. I'm looking for some pointers or directions to address this problem. I try to explain what is happening and I understand that the information provided isn't sufficient to understand what is happening, but I'm trying to solve this and it's driving me nuts :-)

I have several Lucee webapplications (Lucee: 5.3.7.48) which are also available as Cordova app. Error messages are sent to my by e-mail. On a daily bases I receive about 100 messages that the session variable can not be found.

enter image description here enter image description here

[APP] is a session variable, set in the file index.cfm.

         <cfparam name="SESSION.auth.app" default="">

In line 592 there is something like <cfif session.auth.app is 1>do something</cfif>

I don't want to focus on line 592, the real problem is that the session variable is/gets lost. What happens next is that the user is redirect to the login page (login.cfm), because the session is lost and then the problem repeats, it's a kind of loop. The application has a save username/password option.

This all happens when the application is running in the background, like the Cordova app running in the background. I know this because I reached out to a user when receiving 20 error messages, and he told me that I wasn't using the application at the time of the error messages.

In conclusion I measure a user when he is using the login.cfm page. As you van see in the image there is a peak in usage on March 16th, which has to do with the problem described.

enter image description here

I understand that I provided not much useful information to go on, but can someone give me some directions how to approach this problem?

UPDATE April 14th

I have changed the way session vars are set and followed the suggestions in the reactions.

In the application.cfc I have add:

<cffunction name="onSessionStart" access="public" returntype="void" output="false" hint="I fire when a new session begins.">
    <cfset SessionRotate()>
    <cfset SESSION.app = ''>
    <cfset SESSION.device = ''>
    <cfset SESSION.app_file_url = 'window.open'>
</cffunction>

Restarted Lucee just the be sure. But still the same error messages, APP doesn't exist. After some additional searching I found: https://www.bennadel.com/blog/1535-coldfusion-session-is-always-created-even-if-onsessionstart-fails.htm

Could this be a Lucee bug? Are do you have more suggestions to try?

1 Answers

In your onSessionStart function, Can you please change it to this?

<cfset session.auth = {}>

<cfset session.auth.app = ''>

I see you are checking <cfif session.auth.app is 1>do something</cfif> which should have the session.auth defined for it to work.

I hope the above helps.

Also, I'd be interested in knowing what are you dumping on the screen?

Related