You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/05/29 13:26:59 UTC
[Bug 57974] New: getOpenSessions() bug
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
Bug ID: 57974
Summary: getOpenSessions() bug
Product: Tomcat 8
Version: 8.0.22
Hardware: PC
OS: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: WebSocket
Assignee: dev@tomcat.apache.org
Reporter: dstojkov2002@yahoo.fr
the method getOpenSessions() in the class Session return sessions that are not
bound with the endpoint.
In my case I have 2 Endpoints one working with a login/password(go through
request.login ) the other not.
When requesting the open sessions for the "logged" one i get even the session
of the others.
The specification said that getOpenSessions() return the opened sessions of
only one endpoint
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
--- Comment #6 from Remy Maucherat <re...@apache.org> ---
TestWsWebSocketContainer, so it needs more work/review.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
dstojkov <ds...@yahoo.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |critical
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
--- Comment #5 from Remy Maucherat <re...@apache.org> ---
Good point. So I'll backport the fix then.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
--- Comment #4 from Mark Thomas <ma...@apache.org> ---
This issue will occur frequently in POJO endpoints since they all share the
same Endpoint implementation class (which is how I suspect the OP hit this
issue).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
--- Comment #3 from Remy Maucherat <re...@apache.org> ---
Attempting fix in trunk, will backport if there are no issues.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|REOPENED |RESOLVED
--- Comment #9 from Mark Thomas <ma...@apache.org> ---
Thanks for the report.
Fixed in:
- trunk for 9.0.15 onwards
- 8.5.x for 8.5.38 onwards
- 7.0.x for 7.0.93 onwards
While the path works for the server side, the endpoint instance is still the
right choice for the client side. This necessitated a little refactoring as the
client and server share a session implementation.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
Remy Maucherat <re...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Remy Maucherat <re...@apache.org> ---
r1685562 included in 8.0.24
r1685570 included in 7.0.63
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
Zhang Zhongyi <oh...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #8 from Zhang Zhongyi <oh...@gmail.com> ---
Now getOpenSessions can only return the current session.
The problem is that Endpoint is used as the key of the HashMap but its hashCode
and equals method are not overridden. They are directly inherited from Object.
Each time a new connection comes in a new Endpoint instance is created. Because
it uses the hashCode and equals from Object, it will never match any instances
created before even if the request is to the same URL.
My suggestion is to use the URI from session.getRequestURI() as the key of the
map instead of the Endpoint.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
Remy Maucherat <re...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |minor
OS|Windows XP |All
Hardware|PC |All
--- Comment #2 from Remy Maucherat <re...@apache.org> ---
Did you look at the code ? The endpointSessionMap map is keyed on the class
(rather than the endpoint instance) so what you describe can only occur when
you have multiple endpoints from the same endpoint class. This is probably not
correct (need to check first though ...), and is easy to fix, but running into
this issue should not be very common, and it also has an easy workaround.
Adjusting severity accordingly.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 57974] getOpenSessions() bug
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57974
--- Comment #1 from dstojkov <ds...@yahoo.fr> ---
Actually the endpoint share all the sessions with others Endpoints no matter if
it is through login/password or not.
I dont know how you implemented it but this should be something like:
...
private Map<Endpoint, List<Sessions>> endPointMappers
...
Set<Sessions> getSessions(Endpoint ep) {
synchronized(lock) {
return new TreeSet<>(endPointMappers.get(ep));
}
}
Any fix in view ? Or at least a comment on this ? This make the use of
websockets a true nightmare
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org