Elasticsearch does not catch that exception, and fails to initialize if the exception is thrown.
However, it initializes just fine if you set the system property that tells it not to bother invoking the Netty call.
Which means, if any other library in your application uses Netty, and calls that method, and then Elasticsearch calls that method, your application will either:
crash
not have a valid Elasticsearch connection
The advice, given by Elasticsearch, in other discussion is:
this is on application developers to know their application and either:
set the system property I indicated above
allow Elasticsearch to configure Netty first
Oh, and:
This setting is not documented on purpose since it should never be set.
So much bad here:
One, the recommend solution is also recommended to never be done
Two, the onus, apparently is on users of elasticsearch to "know their application", which apparently, means, reading the code base of every dependency they use, in search of possibly conflicting calls to other dependencies, and the undocumented runtime properties that should be set to disable them.
So much bad here. It seems like a better approach would be to:
decide whether or not the Netty availableProcessors is an important enough setting that you want elasticsearch to crash out or not
if it's not important enough, catch the exception, and move on, issuing a warning
if is important enough - why make a workaround where you can disable it?
If you insist on using a system property to ignore the crashing condition, instead of just catching the exception.
decide what is recommended
document it
oh, the best part of all of this the default that Netty uses is exactly the same as the default that elasticsearch uses. Which means that, unless you explicitly set the processor variable, all that Elasticsearch code is just crashing your app in an attempt to set a variable to a value that it's already set to
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.