Skip to content

Improve exception stacktraces#18319

Closed
rmuir wants to merge 6 commits intoelastic:masterfrom
rmuir:painless_debug_stack
Closed

Improve exception stacktraces#18319
rmuir wants to merge 6 commits intoelastic:masterfrom
rmuir:painless_debug_stack

Conversation

@rmuir
Copy link
Copy Markdown
Contributor

@rmuir rmuir commented May 13, 2016

We can improve our stackframes in exceptions to help with debuggability, errors, hot threads, whatever.

  • Give painless the name of the script (stored scripts: the id, file scripts: the filename, inline: null) at compile-time.
  • Reduce length of generated class name.
  • For inline scripts, we have no "filename" but we include some of the script to help identify it, but truncating with ellipsis if its too big or spans multiple lines.
  • Add line number debug information to bytecode. It was added to AST nodes in Make Line Number Available in Painless #18298. We emit this for all leaf S-nodes.

example:

java.lang.NullPointerException
    at org.elasticsearch.painless.Executable$Script.execute(String x = null; boolean y = x.isEmpty(); ... @ <inline script>:1)

@rjernst
Copy link
Copy Markdown
Member

rjernst commented May 13, 2016

LGTM, much nicer looking.

@jdconrad
Copy link
Copy Markdown
Contributor

This is great! Thanks for doing this. +1

@rmuir
Copy link
Copy Markdown
Contributor Author

rmuir commented May 13, 2016

By the way, later we can investigate putting character offsets as line numbers, so the jvm gives us back a more precise location. It is evil but we could do some magic to make it useful.

We gotta start somewhere though, so line numbers seem like walking before running to me.

@jdconrad jdconrad mentioned this pull request May 13, 2016
18 tasks
@uschindler
Copy link
Copy Markdown
Contributor

Looks fine!

@rmuir rmuir closed this in 2028691 May 13, 2016
@clintongormley clintongormley changed the title painless: improve exception stacktraces Improve exception stacktraces May 17, 2016
@clintongormley clintongormley added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache and removed :Plugin Lang Painless labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement v5.0.0-alpha3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants