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...
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.