Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4409

Modify the TokenInterceptor not to lock the session object while handling and invalid token

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3.20
    • Fix Version/s: 2.5.x
    • Component/s: Core Interceptors
    • Labels:
      None
    • Flags:
      Patch

      Description

      Similar to WW-3582. Currently in the TokenInterceptor class in the handleToken method there is a lock on the session object and the handleInvalidToken method is called within that block. In our environment we overrode the handleInvalidToken and it turned out that when this method ran long that any other requests for the user were immediately blocked and the threads were locked up and unable process any further requests.

      I would like to see if we can change the handleToken method not to lock the session when calling the method to handle an invalid token. I realize that ours may not be an ideal implementation and the base implementation should be fast but it does seem like the time an object is locked should be minimized. I don't know if there is a reason that the invalid method would need to be in that block.

      I am including a patch for the change on this. It does not affect the tests and I do not know if there is a good way to add a test that would check the locking.

        Attachments

        1. tokeninterceptor.patch
          1 kB
          Rob Baily

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                rbaily Rob Baily
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: