Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking action invocation out of synchronized block on TokenSessionStoreInterceptor to reduce contention on the session id #339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lunalisk
Copy link

@lunalisk lunalisk commented Mar 1, 2019

We recently ran into an issue with the TokenSessionStoreInterceptor due to it's synchronized block holding until the action invocation returns.

If a different action requires to check something related with the same session key, then this action must wait until the Interceptor releases the lock.

We believe the invocation should not be part of the synchronized block

…reInterceptor to reduce contention

on the session id.
@JCgH4164838Gh792C124B5
Copy link
Contributor

Hello @lunalisk .

It might not be safe to move the invocation outside of the synchronized block within the interceptor. The change in this PR appears to allow for potential concurrent/duplicate submits from the form with the valid token component.

The API docs say the token-mechanism ensures one-request-per-token, but someone from the Apache Struts Team will have to evaluate this PR and comment further.

A more complex solution separating the session-related synchronization and the token-related synchronization might be needed to achieve your desired result. We'll see what they say. :)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0009%) to 48.396% when pulling 18dc30b on lunalisk:reduce-contention-tokenSessionStoreInterceptor into ce4f192 on apache:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants