Skip to content

Conversation

@andrross
Copy link
Member

@andrross andrross commented Aug 8, 2025

IndexStatsIT.testConcurrentIndexingAndStatsRequests sometimes fails with the following NPE:

IndexStatsIT > testConcurrentIndexingAndStatsRequests {p0={"cluster.indices.replication.strategy":"SEGMENT"}} FAILED
    java.lang.AssertionError:
    Expected: an empty collection
         but: <[[test][3] failed, reason [BroadcastShardOperationFailedException[operation indices:monitor/stats failed]; nested: NullPointerException[Cannot invoke "java.util.Map$Entry.getValue()" because "highestEntry" is null]; ]]>
        at __randomizedtesting.SeedInfo.seed([B56C9D0503BD16AE:2FDF6CC817B0190]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:964)
        at org.junit.Assert.assertThat(Assert.java:930)
        at org.opensearch.indices.stats.IndexStatsIT.testConcurrentIndexingAndStatsRequests(IndexStatsIT.java:1451)

The isEmpty() check on the concurrent map is not sufficient because entries can be removed after the check but before retrieving them.

This is one of the failures seen in #15836

Check List

  • Functionality includes testing.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@andrross andrross requested a review from a team as a code owner August 8, 2025 20:14
IndexStatsIT.testConcurrentIndexingAndStatsRequests sometimes fails with
the following NPE:

```
IndexStatsIT > testConcurrentIndexingAndStatsRequests {p0={"cluster.indices.replication.strategy":"SEGMENT"}} FAILED
    java.lang.AssertionError:
    Expected: an empty collection
         but: <[[test][3] failed, reason [BroadcastShardOperationFailedException[operation indices:monitor/stats failed]; nested: NullPointerException[Cannot invoke "java.util.Map$Entry.getValue()" because "highestEntry" is null]; ]]>
        at __randomizedtesting.SeedInfo.seed([B56C9D0503BD16AE:2FDF6CC817B0190]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:964)
        at org.junit.Assert.assertThat(Assert.java:930)
        at org.opensearch.indices.stats.IndexStatsIT.testConcurrentIndexingAndStatsRequests(IndexStatsIT.java:1451)
```

The `isEmpty()` check on the concurrent map is not sufficient because
entries can be removed after the check but before retrieving them.

Signed-off-by: Andrew Ross <[email protected]>
@andrross andrross force-pushed the segment-replicator-npe branch from 1c56866 to e466967 Compare August 8, 2025 20:15
@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2025

❌ Gradle check result for e466967: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2025

❕ Gradle check result for e466967: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@codecov
Copy link

codecov bot commented Aug 9, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.81%. Comparing base (9f13e37) to head (e466967).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...nsearch/indices/replication/SegmentReplicator.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18997      +/-   ##
============================================
- Coverage     72.88%   72.81%   -0.07%     
+ Complexity    69327    69311      -16     
============================================
  Files          5643     5645       +2     
  Lines        318720   318788      +68     
  Branches      46113    46125      +12     
============================================
- Hits         232294   232124     -170     
- Misses        67595    67878     +283     
+ Partials      18831    18786      -45     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrross andrross merged commit 64da5f1 into opensearch-project:main Aug 11, 2025
32 of 35 checks passed
@andrross andrross deleted the segment-replicator-npe branch August 11, 2025 17:40
RajatGupta02 pushed a commit to RajatGupta02/OpenSearch that referenced this pull request Aug 18, 2025
IndexStatsIT.testConcurrentIndexingAndStatsRequests sometimes fails with
the following NPE:

```
IndexStatsIT > testConcurrentIndexingAndStatsRequests {p0={"cluster.indices.replication.strategy":"SEGMENT"}} FAILED
    java.lang.AssertionError:
    Expected: an empty collection
         but: <[[test][3] failed, reason [BroadcastShardOperationFailedException[operation indices:monitor/stats failed]; nested: NullPointerException[Cannot invoke "java.util.Map$Entry.getValue()" because "highestEntry" is null]; ]]>
        at __randomizedtesting.SeedInfo.seed([B56C9D0503BD16AE:2FDF6CC817B0190]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:964)
        at org.junit.Assert.assertThat(Assert.java:930)
        at org.opensearch.indices.stats.IndexStatsIT.testConcurrentIndexingAndStatsRequests(IndexStatsIT.java:1451)
```

The `isEmpty()` check on the concurrent map is not sufficient because
entries can be removed after the check but before retrieving them.

Signed-off-by: Andrew Ross <[email protected]>
atris pushed a commit to atris/OpenSearch that referenced this pull request Aug 28, 2025
IndexStatsIT.testConcurrentIndexingAndStatsRequests sometimes fails with
the following NPE:

```
IndexStatsIT > testConcurrentIndexingAndStatsRequests {p0={"cluster.indices.replication.strategy":"SEGMENT"}} FAILED
    java.lang.AssertionError:
    Expected: an empty collection
         but: <[[test][3] failed, reason [BroadcastShardOperationFailedException[operation indices:monitor/stats failed]; nested: NullPointerException[Cannot invoke "java.util.Map$Entry.getValue()" because "highestEntry" is null]; ]]>
        at __randomizedtesting.SeedInfo.seed([B56C9D0503BD16AE:2FDF6CC817B0190]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:964)
        at org.junit.Assert.assertThat(Assert.java:930)
        at org.opensearch.indices.stats.IndexStatsIT.testConcurrentIndexingAndStatsRequests(IndexStatsIT.java:1451)
```

The `isEmpty()` check on the concurrent map is not sufficient because
entries can be removed after the check but before retrieving them.

Signed-off-by: Andrew Ross <[email protected]>
kh3ra pushed a commit to kh3ra/OpenSearch that referenced this pull request Sep 5, 2025
IndexStatsIT.testConcurrentIndexingAndStatsRequests sometimes fails with
the following NPE:

```
IndexStatsIT > testConcurrentIndexingAndStatsRequests {p0={"cluster.indices.replication.strategy":"SEGMENT"}} FAILED
    java.lang.AssertionError:
    Expected: an empty collection
         but: <[[test][3] failed, reason [BroadcastShardOperationFailedException[operation indices:monitor/stats failed]; nested: NullPointerException[Cannot invoke "java.util.Map$Entry.getValue()" because "highestEntry" is null]; ]]>
        at __randomizedtesting.SeedInfo.seed([B56C9D0503BD16AE:2FDF6CC817B0190]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:964)
        at org.junit.Assert.assertThat(Assert.java:930)
        at org.opensearch.indices.stats.IndexStatsIT.testConcurrentIndexingAndStatsRequests(IndexStatsIT.java:1451)
```

The `isEmpty()` check on the concurrent map is not sufficient because
entries can be removed after the check but before retrieving them.

Signed-off-by: Andrew Ross <[email protected]>
vinaykpud pushed a commit to vinaykpud/OpenSearch that referenced this pull request Sep 26, 2025
IndexStatsIT.testConcurrentIndexingAndStatsRequests sometimes fails with
the following NPE:

```
IndexStatsIT > testConcurrentIndexingAndStatsRequests {p0={"cluster.indices.replication.strategy":"SEGMENT"}} FAILED
    java.lang.AssertionError:
    Expected: an empty collection
         but: <[[test][3] failed, reason [BroadcastShardOperationFailedException[operation indices:monitor/stats failed]; nested: NullPointerException[Cannot invoke "java.util.Map$Entry.getValue()" because "highestEntry" is null]; ]]>
        at __randomizedtesting.SeedInfo.seed([B56C9D0503BD16AE:2FDF6CC817B0190]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:964)
        at org.junit.Assert.assertThat(Assert.java:930)
        at org.opensearch.indices.stats.IndexStatsIT.testConcurrentIndexingAndStatsRequests(IndexStatsIT.java:1451)
```

The `isEmpty()` check on the concurrent map is not sufficient because
entries can be removed after the check but before retrieving them.

Signed-off-by: Andrew Ross <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants