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 formatting of startup/configuration errors #13029

Closed
wants to merge 4 commits into from

Conversation

rmuir
Copy link
Contributor

@rmuir rmuir commented Aug 21, 2015

Previous versions of ES wouldn't give you a stacktrace at all, but just print messages, which left you wondering where that Nested: NullPointerException; came from.

On the other hand, currently in 2.0 if you misconfigure something and piss guice off enough, you will get 2MB of exceptions to the console. Sorry, that is unusable. It may even OOM your terminal window.

This PR attempts to make a compromise, so users arent horrified, but things can be debugged too:

  • It tries to present message and root cause with stacktrace
  • Stacktraces are limited to 30 frames, otherwise truncated, with a message they were truncated
  • Runs of guice frames are replaced with a marker.
  • The user is notified to check the logs for the full error details.

Example:

Exception in thread "main" Failed to resolve address for [_bogushost]
Likely root cause: java.net.UnknownHostException: _bogushost: unknown error
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:907)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1302)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1255)
    at java.net.InetAddress.getAllByName(InetAddress.java:1171)
    at java.net.InetAddress.getAllByName(InetAddress.java:1105)
    at org.elasticsearch.transport.netty.NettyTransport.parse(NettyTransport.java:642)
    at org.elasticsearch.transport.netty.NettyTransport.addressesFromString(NettyTransport.java:594)
    at org.elasticsearch.transport.TransportService.addressesFromString(TransportService.java:388)
    at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing.<init>(UnicastZenPing.java:138)
    at org.elasticsearch.discovery.zen.ping.ZenPingService.<init>(ZenPingService.java:60)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at <<<guice>>>
    at org.elasticsearch.node.Node.<init>(Node.java:190)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:157)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:177)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:272)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:28)
Refer to the log for complete error details.

@s1monw
Copy link
Contributor

s1monw commented Aug 21, 2015

WOW man! what a great idea and how simple!! LGTM go push this to 2.0 as well please

real information and message is the same.
@rjernst
Copy link
Member

rjernst commented Aug 21, 2015

LGTM too

@rmuir rmuir closed this in d083571 Aug 21, 2015
rmuir added a commit that referenced this pull request Aug 21, 2015
Try to strike a balance between usability and debuggability.
2MB stacktrace is not gonna work... we print message and find
"likely root cause" and identify it as such, limit it to 30 stack
frames, and filter out guice. When frames are truncated we identify
that too, and always inform the user full exception is available from
logs.

Closes #13029
@brwe brwe removed the v2.0.0 label Aug 21, 2015
@lcawl lcawl added :Core/Infra/Core Core issues without another label and removed :Exceptions labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >enhancement v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants