apache / apache/druid

Dangling CountDownLatch.await() in tests

Open
#9,285 5 comments 0 reactions 0 assignees View on GitHub
Area - Automation/Static Analysis Area - Testing Bug Contributions Welcome Starter
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

There are several places in tests where the boolean result of `CountDownLatch.await(timeout)` is not tested. It should properly be wrapped into `assertTrue()` in (almost) all cases. Currently, these tests don't really verify the correctness of the production code.

See https://github.com/code-review-checklists/java-concurrency#check-await

To systematically eradicate these bugs, either the configuration for "Result of method call is ignored" inspection should be edited and the inspection is enabled on error level (which I think is preferable because we want to strictly check this inspection anyway), or a separate [Structural Search pattern](https://github.com/apache/druid/blob/master/dev/teamcity.md#creating-a-custom-inspection-from-a-structural-search-pattern) could be easily created.

Contributor guide

Open the contributing guide

Research direction

Search the tests for CountDownLatch.await(timeout) calls whose boolean result is ignored, then read the IntelliJ "Result of method call is ignored" inspection configuration and the structural-search guidance in dev/teamcity.md. Done means the affected test calls assert their result and a chosen inspection or search rule catches remaining cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.