Repository navigation
Conversation
|
Thanks, the analysis holds: Worth saying what the practical effect is, because the PR describes only the size counter: every entry left behind after Two requests before merging:
Scope note: please keep the PR to this. Changing what the interceptor locks on would be a behaviour change and is out of scope here. |
9061a54 to
6947262
Compare
The static lock table was an unsynchronized IdentityHashMap mutated from concurrent requests, which do not share the per-request session monitor. Beyond the corrupted size counter, this is a slow leak under concurrent load: every entry left behind after unlock() pins a SessionMap (and through it the request and session) plus the whole ActionInvocation, for any application using the opt-in `scope` interceptor. It is now wrapped with Collections.synchronizedMap.
6947262 to
0f0a21f
Compare
|
@lukaszlenart Ready For Review !! |
Fixes WW-5826
ScopeInterceptor.locksis a staticIdentityHashMapshared by all requests.lock()/unlock()mutate it insidesynchronized (o), butois the session map, whichDispatchercreates per request, so concurrent requests never share that monitor and the map is modified unsynchronized. It is nowCollections.synchronizedMap(...), which also matches thesynchronized (locks)already used byclearLocks().Beyond the corrupted size counter, this is a slow leak under concurrent load: every entry left behind after
unlock()pins aSessionMap(and through it the request and session) plus the wholeActionInvocation, for any application using the opt-inscopeinterceptor.ScopeInterceptorTest#testConcurrentLockAndUnlockLeavesNoEntriesruns 8 threads x 500 lock/unlock pairs on distinct objects and asserts the table is empty afterwards (via a package-privatelockCount()next toclearLocks(), not reflection). Without the change it failed in every run I made; with the change it passed 5/5.The test is statistical: it can pass without the fix on a fast machine, but it never fails with the fix.
Not changed: what
ScopeInterceptorlocks on. Not claiming a security issue or any cross-request data exposure; only the corrupted map size and the resulting retention were measured. The same kind of change for the XSLT plugin'sBeanAdaptercache is a separate PR.