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

[BUG] Test case org.opensearch.action.admin.cluster.shards.CatShardsRequestTests.testSerializationWithOlderVersionsParametersNotSerialized fails with NPE #16580

Closed
reta opened this issue Nov 6, 2024 · 5 comments
Labels
bug Something isn't working Other

Comments

@reta
Copy link
Collaborator

reta commented Nov 6, 2024

Describe the bug

The test case org.opensearch.action.admin.cluster.shards.CatShardsRequestTests.testSerializationWithOlderVersionsParametersNotSerialized fails with NPE:

java.lang.NullPointerException: Cannot invoke "String.length()" because "str" is null
	at __randomizedtesting.SeedInfo.seed([644E83AFC71A1C4F:8FD495376ADAAC0E]:0)
	at org.opensearch.core.common.io.stream.StreamOutput.writeString(StreamOutput.java:444)
	at org.opensearch.core.common.io.stream.StreamOutput.writeStringArray(StreamOutput.java:547)
	at org.opensearch.action.admin.cluster.shards.CatShardsRequest.writeTo(CatShardsRequest.java:57)
	at org.opensearch.action.admin.cluster.shards.CatShardsRequestTests.testSerializationWithOlderVersionsParametersNotSerialized(CatShardsRequestTests.java:101)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.apache.lucene.tests.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:48)
	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
	at org.apache.lucene.tests.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:45)
	at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
	at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.tests.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:38)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.tests.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
	at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
	at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
	at org.apache.lucene.tests.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:47)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Related component

Other

To Reproduce

Pull https://github.com/opensearch-project/OpenSearch/pull/16571 and run ./gradlew ':server:test' --tests "org.opensearch.action.admin.cluster.shards.CatShardsRequestTests.testSerializationWithOlderVersionsParametersNotSerialized"

Expected behavior

The test case should pass

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • CI

Additional context
Add any other context about the problem here.

@reta reta added bug Something isn't working untriaged labels Nov 6, 2024
@github-actions github-actions bot added the Other label Nov 6, 2024
@reta
Copy link
Collaborator Author

reta commented Nov 6, 2024

@gargharsh3134 could you please take a look? caused by #14641 / #16455

@reta
Copy link
Collaborator Author

reta commented Nov 6, 2024

Blocks #16571

@dbwiddis
Copy link
Member

dbwiddis commented Nov 7, 2024

The test creates a string array:

But the elements of the array are null, and thus fail when attempting to serialize for transport.

The failure didn't occur on 3.0.0 or 2.8.0 because the previous version didn't pass the "on or after" check and never attempted to serialize the array of nulls. It's failing on 2.8.1 because the previous version is 2.8.0 and does meet the earlier version on or after 2.8.0, and reads the string array.

Fix is probably populating that string array with some random strings, similar to how is done in another test in the same class:

String[] indices = new String[numIndices];
for (int i = 0; i < numIndices; i++) {
indices[i] = randomAlphaOfLengthBetween(3, 10);
}

@dblock
Copy link
Member

dblock commented Nov 25, 2024

@dbwiddis Did #16590 fix this? Backported? Close?

[Catch All Triage - 1, 2, 3, 4, 5]

@dbwiddis
Copy link
Member

Yes, this was fixed by #16590 and #16591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Other
Projects
None yet
Development

No branches or pull requests

3 participants