Closed boris-senapt closed 8 months ago
I wasn't able to reproduce it and am not really sure which scenario can cause this (the request ID should be unique, so the listener should only run once). Anyhow I think I have something which can prevent this. Can you give the code in the PR that I just opened a try?
Will do.
I think the change makes sense anyway as from inside a synchonized
method you were returning the contents of store
(a non-thread safe HashMap
); the behaviour of concurrent access would also be undefined.
Not related to this issue, but I think it's more robust.
I ran the following
git clone git@github.com:wiremock/wiremock-state-extension.git
git sw bugfix/concurrent-transaction-modification
gradle publishToMavenLocal
This published 0.6.0-SNAPSHOT
, so I updated my pom.xml
with that version and ran my project test that exhibited the issue.
I no longer see the exception thrown.
thx for checking.
Version 0.6.2 containing this fix is available now.
Proposal
I see this exception when running. It doesn't seem to cause problems
It seems to be cause by
Where
transactionManager.getContextNamesByRequestId
returns the thekeySet()
oftransaction:"
andtransactionManager.deleteTransaction
accesses the sameMap
and callsremove()
Reproduction steps
Not entirely sure here - I haven't looked too much into what the
TransactionManager
does or why its used.References
No response