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

PointcutLatch is not properly thread safe, and the hapi-fhir-jpaserver-subscription tests are flaky as a result #1337

Closed
srdo opened this issue Jun 8, 2019 · 0 comments

Comments

@srdo
Copy link
Contributor

commented Jun 8, 2019

Describe the bug
The PointcutLatch class is misusing CountDownLatch, by sharing an instance between threads through a non-final non-volatile field. It is also sharing AtomicReference references through non-final non-volatile fields.

Some of the hapi-fhir-jpaserver-subscription tests that subclass BaseBlockingQueueSubscribableChannelDstu3Test are printing exceptions to log when running, since they don't properly assert latch countdowns, and so the PointcutLatch logs that it was counted down unexpectedly. For example, try running the SubscriptionLoaderFhirClientTest, which registers subscriptions without asserting that the subscription activation latch should be counted down.

Finally, the hapi-fhir-jpaserver-subscription tests occasionally fail on heavily loaded machines, as the test Fhir server lazily loads StructureDefinitions on first use. The tests usually trigger this load by e.g. sending an Observation to the server, which should then count down a latch. The failure occurs because the test fails if counting down the latch takes more than 10 seconds, and loading StructureDefinitions the first time sometimes takes that long.

To Reproduce
Steps to reproduce the behavior:
Run the hapi-fhir-jpaserver-subscription tests a couple of times. The tests will occasionally fail when a latch fails to get counted down.

Expected behavior
The tests should not fail unless the production code is broken.

fil512 added a commit that referenced this issue Jun 10, 2019

@srdo srdo closed this Jun 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.