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

Fix NullPointerException in cat-recovery API #6190

Merged
merged 1 commit into from Jun 20, 2014

Conversation

martijnvg
Copy link
Member

The recovery type isn't serialized. This can cause a NPE like this:

Caused by: java.lang.NullPointerException
        at org.elasticsearch.indices.recovery.RecoveryState.writeTo(RecoveryState.java:244)
        at org.elasticsearch.action.admin.indices.recovery.ShardRecoveryResponse.writeTo(ShardRecoveryResponse.java:87)
        at org.elasticsearch.transport.netty.NettyTransportChannel.sendResponse(NettyTransportChannel.java:83)
        at org.elasticsearch.transport.netty.NettyTransportChannel.sendResponse(NettyTransportChannel.java:62)
        at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$ShardTransportHandler.messageReceived(TransportBroadcastOperationAction.java:413)
        at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$ShardTransportHandler.messageReceived(TransportBroadcastOperationAction.java:399)
        at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:270)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)

@s1monw
Copy link
Contributor

s1monw commented May 15, 2014

the change looks good but how come this never triggered a failure? can you add a test maybe?

@s1monw
Copy link
Contributor

s1monw commented Jun 12, 2014

@martijnvg can we make this fail somehow with a simple test?

@s1monw s1monw added bug and removed review labels Jun 12, 2014
@martijnvg
Copy link
Member Author

@s1monw Updated the PR, when backporting I will add the 1.2.2 version to the 1.2 branch.

assertThat(outRequest.recoveryType(), equalTo(inRequest.recoveryType()));
assertThat(outRequest.recoveryId(), equalTo(inRequest.recoveryId()));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could also have a test for the backwards compatibility where we randomize the versions we read from and we write to and we check that everything is ok?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. I updated the PR.

@martijnvg martijnvg added review and removed v1.2.1 labels Jun 12, 2014
@@ -115,6 +115,9 @@ public void readFrom(StreamInput in) throws IOException {
StoreFileMetaData md = StoreFileMetaData.readStoreFileMetaData(in);
existingFiles.put(md.name(), md);
}
if (in.getVersion().onOrAfter(Version.V_1_3_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we intend to backport we should set it to 1.2.2?

@s1monw s1monw removed the review label Jun 18, 2014
@s1monw
Copy link
Contributor

s1monw commented Jun 18, 2014

left a comment regarding the version check, other than that LGTM

@martijnvg martijnvg merged commit 73e4a9b into elastic:master Jun 20, 2014
martijnvg added a commit that referenced this pull request Jun 20, 2014
martijnvg added a commit that referenced this pull request Jun 20, 2014
@clintongormley clintongormley changed the title Cat recovery api can return NPE Cat API: Cat recovery api can return NPE Jul 9, 2014
@clintongormley clintongormley changed the title Cat API: Cat recovery api can return NPE Cat API: Fix NullPointerException in cat-recovery API Jul 9, 2014
@martijnvg martijnvg deleted the bugs/recovery-stats-npe branch May 18, 2015 23:31
@clintongormley clintongormley added the :Data Management/CAT APIs Text APIs behind /_cat label Jun 7, 2015
@clintongormley clintongormley changed the title Cat API: Fix NullPointerException in cat-recovery API Fix NullPointerException in cat-recovery API Jun 7, 2015
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants