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

Tabs in config file causes service not to start #9193

Closed
markwalkom opened this issue Jan 8, 2015 · 1 comment
Closed

Tabs in config file causes service not to start #9193

markwalkom opened this issue Jan 8, 2015 · 1 comment
Labels

Comments

@markwalkom
Copy link
Contributor

Here is a sample file where spaces are used to pad a config setting;

root@vagrant-ubuntu-trusty-64:/etc/elasticsearch# cat -T elasticsearch.yml
node:
        name: test
root@vagrant-ubuntu-trusty-64:/etc/elasticsearch# service elasticsearch start
 * Starting Elasticsearch Server                                                                                                                                                                                                                                    [ OK ]
root@vagrant-ubuntu-trusty-64:/etc/elasticsearch# ps -fe|grep java
elastic+  1761     1 99 07:31 ?        00:00:02 /usr/bin/java -Xms256m -Xmx1g -Xss256k -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.pidfile=/var/run/elasticsearch.pid -Des.path.home=/usr/share/elasticsearch -cp :/usr/share/elasticsearch/lib/elasticsearch-1.4.2.jar:/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/lib/sigar/* -Des.default.config=/etc/elasticsearch/elasticsearch.yml -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/var/log/elasticsearch -Des.default.path.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=/etc/elasticsearch org.elasticsearch.bootstrap.Elasticsearch
root      1775  1635  0 07:31 pts/0    00:00:00 grep --color=auto java

And here is similar with a tab;

root@vagrant-ubuntu-trusty-64:/etc/elasticsearch# cat -T elasticsearch.yml
node:
^Iname: test
root@vagrant-ubuntu-trusty-64:/etc/elasticsearch# service elasticsearch start
 * Starting Elasticsearch Server                                                                                                                                                                                                                                    [ OK ]
root@vagrant-ubuntu-trusty-64:/etc/elasticsearch# ps -ef|grep java
root      1913  1635  0 07:33 pts/0    00:00:00 grep --color=auto java

The tab is confirmed as the problem when you call the binary with it's arguments manually;

root@vagrant-ubuntu-trusty-64:/etc/elasticsearch# /usr/bin/java -Xms256m -Xmx1g -Xss256k -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.pidfile=/var/run/elasticsearch.pid -Des.path.home=/usr/share/elasticsearch -cp :/usr/share/elasticsearch/lib/elasticsearch-1.4.2.jar:/usr/share/elasticsearch/lib/*:/usr/share/elasticsearch/lib/sigar/* -Des.default.config=/etc/elasticsearch/elasticsearch.yml -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/var/log/elasticsearch -Des.default.path.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=/etc/elasticsearch org.elasticsearch.bootstrap.Elasticsearch
{1.4.2}: Setup Failed ...
- SettingsException[Failed to load settings from [file:/etc/elasticsearch/elasticsearch.yml]]
    IOException[Tabs are illegal in YAML.  Did you mean to use whitespace character instead?]
org.elasticsearch.common.settings.SettingsException: Failed to load settings from [file:/etc/elasticsearch/elasticsearch.yml]
    at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:947)
    at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromUrl(ImmutableSettings.java:931)
    at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:63)
    at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:106)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:177)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: java.io.IOException: Tabs are illegal in YAML.  Did you mean to use whitespace character instead?
    at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:44)
    at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:944)
    ... 5 more

I think this is important to address as some of the config examples we have on the site are spaced similar to this, and someone may inadvertently use tabs and wonder why things don't start.

@clintongormley
Copy link

Tabs are illegal in YAML. Previously we used to treat them as two spaces, but if you happen to use a different indentation level that could result in incorrect configuration. It is safer to just throw an exception (which I think is pretty self-explanatory).

See #8355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants