You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ourLog.error("Failure during snapshot generation", e);
myAllStructures = null;
}
Starting from the try block, the cached StructureDefinitions are snapshotted. However, instead of creating a new List for the resulting snapshotted StructureDefinitions, the resulting Resources are added to the list of previously fetched and converted StructureDefinitions. I am sure this is not correct, because both the non-snapshotted and the snapshotted version are stored to the same list.
In addition to that, the issue causes ConcurrentModificationExceptions, since the List being modified in the try block was stored to the myAllStructures field before. When a second thread calls allStructureDefinitions, before the first one enters the try block, it will get the list and can read it, while the first thread adds elements to that list.
However, this issue is easy to fix: Before entering the try, add the line
retVal = newArrayList<>();`
@fil512 it seems this was introduced in commit 362dc09 by you. At least you are attributed as the author. Maybe you want to fix the issue, since this is a pretty trivial fix, I can open a PR as well, if this is preferred.
To Reproduce
Steps to reproduce the behavior:
Validate several resources in parallel.
The text was updated successfully, but these errors were encountered:
Describe the bug
The following code on the current (at the time of writing) master:
hapi-fhir/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java
Lines 232 to 246 in e412b38
Starting from the
try
block, the cached StructureDefinitions are snapshotted. However, instead of creating a newList
for the resulting snapshotted StructureDefinitions, the resulting Resources are added to the list of previously fetched and converted StructureDefinitions. I am sure this is not correct, because both the non-snapshotted and the snapshotted version are stored to the same list.In addition to that, the issue causes
ConcurrentModificationException
s, since theList
being modified in the try block was stored to themyAllStructures
field before. When a second thread callsallStructureDefinitions
, before the first one enters thetry
block, it will get the list and can read it, while the first thread adds elements to that list.However, this issue is easy to fix: Before entering the try, add the line
@fil512 it seems this was introduced in commit 362dc09 by you. At least you are attributed as the author. Maybe you want to fix the issue, since this is a pretty trivial fix, I can open a PR as well, if this is preferred.
To Reproduce
Steps to reproduce the behavior:
Validate several resources in parallel.
The text was updated successfully, but these errors were encountered: