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

Cannot 'reset' index settings to default #24709

Closed
nixfloyd opened this Issue May 16, 2017 · 9 comments

Comments

Projects
None yet
3 participants
@nixfloyd
Copy link

nixfloyd commented May 16, 2017

Elasticsearch version:5.4.0

Plugins installed: []

JVM version (java -version):

# java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

OS version

# cat /etc/centos-release
CentOS release 6.9 (Final)
# uname -a
Linux host1.domain.com 2.6.32-642.15.1.el6.x86_64 #1 SMP Fri Feb 24 14:31:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
According to #22870, it should be possible to 'revert/reset' an index' settings to default by using a null value. Unfortunately, this doesn't work on 5.4.0 (while it was working as expected on 5.0.2)

Steps to reproduce:
The index name/size/content doesn't really matter. On (at least) 5.0.2, this api call works as expected. On 5.4.0, it doesn't anymore, returning a null pointer exception.

On elasticsearch 5.0.2:

# curl -XPUT localhost:9200/indexname/_settings -d '{ "index.routing.allocation.require._ip": "10.0.0.11,10.0.0.12" }'
{"acknowledged":true}
# curl -XPUT localhost:9200/indexname/_settings -d '{ "index.routing.allocation.require._ip": null }'
{"acknowledged":true}

On elasticsearch 5.4.0:

# curl -XPUT localhost:9200/indexname/_settings -d '{ "index.routing.allocation.require._ip": "10.0.0.11,10.0.0.12" }'
{"acknowledged":true}
# curl -XPUT localhost:9200/indexname/_settings -d '{ "index.routing.allocation.require._ip": null }'
{
 "error" : {
   "root_cause" : [
     {
       "type" : "null_pointer_exception",
       "reason" : null
     }
   ],
   "type" : "null_pointer_exception",
   "reason" : null
 },
 "status" : 500
}

Provide logs (if relevant):

[2017-05-16T11:38:10,618][WARN ][r.suppressed             ] path: /indexname/_settings, params: {index=indexname}
java.lang.NullPointerException: null
	at org.elasticsearch.cluster.node.DiscoveryNodeFilters.lambda$static$0(DiscoveryNodeFilters.java:53) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.common.settings.Setting$3.get(Setting.java:908) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.common.settings.Setting$3.get(Setting.java:885) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:295) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:256) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.cluster.metadata.MetaDataUpdateSettingsService.updateSettings(MetaDataUpdateSettingsService.java:166) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.admin.indices.settings.put.TransportUpdateSettingsAction.masterOperation(TransportUpdateSettingsAction.java:89) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.admin.indices.settings.put.TransportUpdateSettingsAction.masterOperation(TransportUpdateSettingsAction.java:44) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.master.TransportMasterNodeAction.masterOperation(TransportMasterNodeAction.java:87) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$2.doRun(TransportMasterNodeAction.java:166) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:110) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction.doStart(TransportMasterNodeAction.java:163) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction.start(TransportMasterNodeAction.java:126) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.master.TransportMasterNodeAction.doExecute(TransportMasterNodeAction.java:104) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.master.TransportMasterNodeAction.doExecute(TransportMasterNodeAction.java:54) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:170) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:142) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:84) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.client.node.NodeClient.executeLocally(NodeClient.java:83) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.client.node.NodeClient.doExecute(NodeClient.java:72) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1256) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.updateSettings(AbstractClient.java:1637) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.rest.action.admin.indices.RestUpdateSettingsAction.lambda$prepareRequest$0(RestUpdateSettingsAction.java:76) ~[elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:80) [elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:260) [elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:199) [elasticsearch-5.4.0.jar:5.4.0]
	at org.elasticsearch.http.netty4.Netty4HttpServerTransport.dispatchRequest(Netty4HttpServerTransport.java:504) [transport-netty4-5.4.0.jar:5.4.0]
	at org.elasticsearch.http.netty4.Netty4HttpRequestHandler.channelRead0(Netty4HttpRequestHandler.java:72) [transport-netty4-5.4.0.jar:5.4.0]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at org.elasticsearch.http.netty4.pipelining.HttpPipeliningHandler.channelRead(HttpPipeliningHandler.java:63) [transport-netty4-5.4.0.jar:5.4.0]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at org.elasticsearch.http.netty4.cors.Netty4CorsHandler.channelRead(Netty4CorsHandler.java:76) [transport-netty4-5.4.0.jar:5.4.0]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [netty-codec-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [netty-codec-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) [netty-codec-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:524) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:478) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438) [netty-transport-4.1.9.Final.jar:4.1.9.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-common-4.1.9.Final.jar:4.1.9.Final]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_102]
@danielmitterdorfer

This comment has been minimized.

Copy link
Member

danielmitterdorfer commented May 16, 2017

Thanks for the report @nixfloyd. This regression has been introduced in Elasticsearch 5.3.0 which I could reproduce locally.

@danielmitterdorfer

This comment has been minimized.

Copy link
Member

danielmitterdorfer commented May 16, 2017

This problem is still present on master. As we require a content-type header in 6.0, the full reproduction is:

curl -XPUT http://localhost:9200/test_index
curl -H "Content-Type: application/json" -XPUT localhost:9200/test_index/_settings -d '{ "index.routing.allocation.require._ip": "10.0.0.11,10.0.0.12" }'
curl -H "Content-Type: application/json" -XPUT localhost:9200/test_index/_settings -d '{ "index.routing.allocation.require._ip": null }'
@danielmitterdorfer

This comment has been minimized.

Copy link
Member

danielmitterdorfer commented May 16, 2017

The root cause seems to be that the IP validator that has been introduced in #22591 is not aware of null values. @abeyad can you please have a look?

s1monw added a commit to s1monw/elasticsearch that referenced this issue May 16, 2017

Allow resetting settings that use and IP validator
The IP validator doesn't expect a null value for a setting that causes NPEs
if a user tries to reset a setting that uses this validator.

Closes elastic#24709

@s1monw s1monw self-assigned this May 16, 2017

@s1monw

This comment has been minimized.

Copy link
Contributor

s1monw commented May 16, 2017

@abeyad I opened a PR for this here #24713

@s1monw s1monw removed the help wanted label May 16, 2017

s1monw added a commit that referenced this issue May 16, 2017

Allow resetting settings that use and IP validator (#24713)
The IP validator doesn't expect a null value for a setting that causes NPEs
if a user tries to reset a setting that uses this validator.

Closes #24709

s1monw added a commit that referenced this issue May 16, 2017

Allow resetting settings that use and IP validator (#24713)
The IP validator doesn't expect a null value for a setting that causes NPEs
if a user tries to reset a setting that uses this validator.

Closes #24709

s1monw added a commit that referenced this issue May 16, 2017

Allow resetting settings that use and IP validator (#24713)
The IP validator doesn't expect a null value for a setting that causes NPEs
if a user tries to reset a setting that uses this validator.

Closes #24709
@s1monw

This comment has been minimized.

Copy link
Contributor

s1monw commented May 16, 2017

@nixfloyd thanks so much for reporting this issue!

@nixfloyd

This comment has been minimized.

Copy link

nixfloyd commented May 16, 2017

@s1monw np, thanks everyone for the quick response. I assume the fix should make it to 5.4.1 or so?
Thanks!

debadair added a commit to debadair/elasticsearch that referenced this issue May 16, 2017

Allow resetting settings that use and IP validator (elastic#24713)
The IP validator doesn't expect a null value for a setting that causes NPEs
if a user tries to reset a setting that uses this validator.

Closes elastic#24709
@danielmitterdorfer

This comment has been minimized.

Copy link
Member

danielmitterdorfer commented May 17, 2017

@nixfloyd This fix is too late for 5.4.1 but it will be included in 5.4.2 (see also the labels on PR #24713).

@danielmitterdorfer

This comment has been minimized.

Copy link
Member

danielmitterdorfer commented May 17, 2017

Good news @nixfloyd: We're able to include this fix already for 5.4.1.

@nixfloyd

This comment has been minimized.

Copy link

nixfloyd commented May 19, 2017

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment