Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 7.0.2
-
Fix Version/s: 7.3.1
-
Component/s: HTTP
-
Labels:None
-
Environment:Found on version 7.0.1. I looked at the latest source, and it appears that the problem would still exist.
-
Testcase included:yes
-
Number of attachments :
Description
Using HashSessionIdManager, I set the workerName to be the fqdn of the host. e.g. (host.domain.com)
After doing so, session lookups fail.
The problem comes from the HashSessionIdManager.getClusterId method...
public String getClusterId(String nodeId) { int dot=nodeId.lastIndexOf('.'); return (dot>0)?nodeId.substring(0,dot):nodeId; }
This problem is also seen in the JDBCSessionIdManager
The input nodeId argument will be "<sessionId>.host.domain.com". e.g. "1f2jo7j8m3d2h.host.domain.com"
The expected return value is "<sessionId>". e.g. "1f2jo7j8m3d2h"
However, the actual return value is "<sessionId>.host.domain.". e.g. "1f2jo7j8m3d2h.host.domain"
Since the return value is incorrect, AbstractSessionManager.getHttpSession fails to find the existing session, and a new session will end up being created.
A workaround is to avoid "." in the workerName.
I recommend either
- Defending against "." (by replacing them with underscores or throwing an exception or something), OR
- Documenting that workerName must not contain a dot ".".
You could also use indexOf instead of lastIndexOf, but then you'd need to ensure the <sessionId> does not contain a dot.
An illegalstateexception is thrown if the worker name contains '.'
thanks