Bug 58059 - Value for @PathParam annotated variable in @OnOpen is not correct
Summary: Value for @PathParam annotated variable in @OnOpen is not correct
Status: RESOLVED DUPLICATE of bug 57969
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: WebSocket (show other bugs)
Version: 8.0.23
Hardware: PC All
: P2 major (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2015-06-19 21:41 UTC by Aaron Neal
Modified: 2015-06-20 04:30 UTC (History)
0 users

Test projects to show @PathParam issues (8.66 KB, application/x-zip-compressed)
2015-06-19 21:41 UTC, Aaron Neal

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Neal 2015-06-19 21:41:11 UTC
Created attachment 32837 [details]
Test projects to show @PathParam issues

When connecting to a websocket server endpoint in Tomcat 8.0.23, the mechanism for populating a @PathParam annotated variable in the @OnOpen method does not appear to be thread safe.

I have set up 2 test projects;  one that is a single class container web-application that handles websockets, and a client that connects to said websocket.

When multiple requests come in with different path params, the value that is passed on to the @OnOpen annotated method into the @PathParam annotated variable does not match the value that is found in the Session.getPathParameters() collection for the same session.  It appears that the @PathParam annotated variable is being overwritten with another connection request's path param.

Here is some sample output from the attached "WebsocketPathParamIssueClient" project showing the path param that was sent, what was set in the @PathParam annotated variable, and what is in the Session.getPathParaters() collection:

2015-06-19 15:07:22.460 INFO  [Grizzly(2)] 
[pathParam=DDDDD, sessionId=c880b807-8a9e-4180-9bdb-3bc65e358556] pathParamVariable=BBBBB | pathParamSession=DDDDD
2015-06-19 15:07:22.460 INFO  [Grizzly(2)] 
[pathParam=CCCCC, sessionId=9fa55740-30b5-41ad-8871-dfb553d04dc5] pathParamVariable=CCCCC | pathParamSession=CCCCC
2015-06-19 15:07:22.460 INFO  [Grizzly(2)] 
[pathParam=BBBBB, sessionId=a578cd97-94d7-4d69-9e26-3862d8447a53] pathParamVariable=BBBBB | pathParamSession=BBBBB
2015-06-19 15:07:22.460 INFO  [Grizzly(2)] 
[pathParam=AAAAA, sessionId=2540e0ef-2c8a-456b-9d9e-ee0f1550840d] pathParamVariable=BBBBB | pathParamSession=AAAAA
Comment 1 Violeta Georgieva 2015-06-20 04:30:46 UTC

*** This bug has been marked as a duplicate of bug 57969 ***