-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null sessionScope argument being sent to onOpen Listener Component callback #10
Comments
Are you sure that a Session is created for that |
The cfid cookie being sent in the websocket request header is different from the user's Session.cfid. |
Not sure what you mean? They should be the same. Do you mean that you are sending different ones on purpose or that you are trying to send the same one but somehow upon inspection you found that they are different? In any event, that would explain your issue. The extension has no way of knowing the Session.cfid on its own. It takes the Let's keep questions/answers in the Lucee dev forum and only open tickets after confirming a bug/issue. |
I'm not manually setting headers, and I'm just noticing the difference in the cfid values. Could be related to logging in and logging out, and attempting to reset my session. I created a post: https://dev.lucee.org/t/websockets-extension-get-correct-session-scope/2694 |
Igal, it's been a while since I got into my websocket testing. I just pushed websockets using your extension to production using the latest lucee release and the latest websocket release. This is still an issue, though it's difficult to reproduce. Seems like the extension is not finding the current session, though normal, non-websocket requests are working fine... the session is found. First thing, could your code check for a null session before passing it into the onOpen method? Or, should I be doing that, in which case my code would assume that there is no session and would refuse the connection? Second thing, since the tomcat websocket should be finding the session, what can I do to help figure out what's going on? Here's some of the logging information that is relevant: From websocket.log:
From my own logging - stack trace for the exception when trying to use the null session scope passed into the onOpen() method:
And the code where the exception occurs:
|
One thing that comes to mind is that this seems to occur after sessions have been terminated, followed by a new one being created. This happens when the user walks away from the computer and comes back after the session timeout setting. A refresh of the page will create a new session. |
I am having a similar issue but in my case, I am using WSS secured sockets. It works in both Firefox and Google Chrome, but for IE Edge the session is null. I've done as much debugging as possible, and I know that for IE Edge the cookie is different from the application. Before I setup the HttpSessionInitializerFilter, the same thing was happening for all browsers, so I was thinking it might be related to HttpSessionInitializerFilter and IE Edge. |
I'm also using wss, and I'm seeing this in Chrome. I haven't tested with Edge. In my limited testing, FF seems okay. Also, when this condition occurs, the session will never be found, even if I completely quit the browser and open it again. The condition appears to occur in perpetuity - the websocket extension will never find the session, even after many days. |
A few more observations and clarifications:
|
Any movement on this Igal? Timeframe? |
I'm sorry. Been extremely busy lately and no time frame ATM. |
isapir, any tips on getting this project loaded up for debugging? i would like to help out, but not really sure on where to start with testing this project. IE, would I need to download the tomcat project and step into it to be able to hit your code? |
@silashatfield I would be happy to help from my Lucee app. I've got Fusion Reactor running and can dig into it as much as needed, and I can reproduce the issue quite easily. |
I may have stumbled upon the root problem with NULL session arguments. I was running a test with 2 browsers. One browser connected to the websocket channel fine, and the other didn't. In the browser that worked, the onOpen() method of my listener was being sent a NULL session argument, which was causing the onOpen method to return false. Looking deeper, in the browser that did work, there was only one I believe this was happening because I had After turning off Would it be possible to enhance the code that attempts to find the correct session to take into consideration domain cookies? |
Interesting. I am not sure that the domain is sent with the Request's cookie. Can you check the Request headers when setDomainCookies is enabled vs. disabled? |
Looks like all you get are duplicate When finding a session, perhaps you could you use the I've since set BTW, since I had already fixed the duplicate cfid cookie problem in the browser, I had trouble getting back in that state after setting |
I added a pull request a few months back to resolve the issue. Browsers are storing the cookie values in different case formats, IE Cfid CFID cfid. When trying to set the session, it does not correctly get the header which makes it null. |
@silashatfield I see your change... but I would expect that further changes would be needed to handle multiple |
I'm updating this thread because I recently implemented client-side code (in javascript) to close/open connections for various reasons... like if the app is inactive, or is no longer in focus, etc. In testing, I began noticing that sometimes I could not re-open a connection that I had just closed. I began digging into the logs, and I noticed that the extension was passing in NULL session scopes randomly. Most of the time the socket was successfully re-opened, and sometimes I would get a NULL session. I eliminated the issue where multiple cfid's may have been causing the extension to not find the correct session, and I verified in the logs that the correct CFID was being used when a NULL session was passed in. Here's an excerpt from the logs when this happens:
Not sure why the logs say that the channel was opened because it most definitely wasn't. @isapir, I'm wondering what it will take to dig a little deeper into this issue? |
I've noticed this happening intermittently, but now it's consistent. When I dump the Arguments scope of my onOpen callback, I'm getting a null sessionScope.
Why would this be happening, and how can I debug?
The text was updated successfully, but these errors were encountered: