Hi, Philip,

In the telemetry viewer for 413, I need to run the same analyses for different projects. So multiple requests are send at the same time:

Request1: do analysis for Project AAA
Request2: do analysis for Porject BBB
....

One the server side, the ProjectSelector.afterCommandReceivedHook() will store the last selected project by calling:
user.put("selector.ProjectDefault", lastSelectedProjectName)


Then (still on the server side), the analysis needs to find out what the project the user has selected by calling
ProjectSelector.getSelectedProject()
which in turn calls
user.get("selector.ProjectDefault").


Now think what might happen when two requests are sent at the same time.
  Request1: user.put("selector.ProjectDefault", "AAA")
  Request2: user.put("selector.ProjectDefault", "BBB")
  Request1: user.get("selector.ProjectDefault") returns "BBB"
  Request2: user.get("selector.ProjectDefault") returns "BBB"
But what request1 has requested is "AAA".

I have two solutions for the problem:
  (1) put the last selected project information in thread local storage.
  (2) put it in user session.


Since all our selector follow the same pattern, they are all unsafe.

Telemetry wall is ready, but if this bug cannot get fixed before Wednesday, it cannot be used.

Sincerely,

Cedric






Reply via email to