Skip to content

Binary execution support#1

Merged
theobisproject merged 33 commits intotheobisproject:binary-execution-supportfrom
SylvainJuge:binary-execution-support
Dec 7, 2019
Merged

Binary execution support#1
theobisproject merged 33 commits intotheobisproject:binary-execution-supportfrom
SylvainJuge:binary-execution-support

Conversation

@SylvainJuge
Copy link
Copy Markdown

This PR contains changes required for elastic#903

  • feature renamed to process for consistency, part of incubating instrumentations that are disabled by default
  • no need to have commons-exec instrumentation as it relies on java.lang.Process under the hood
  • tests require to use integration tests because instrumented classes are in the bootstrap classloader (can't be instrumented by agent in unit tests yet)

Copy link
Copy Markdown
Owner

@theobisproject theobisproject left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good from my point of view. Just a few minor things


int returnValue;
try {
Process process = Runtime.getRuntime().exec(cmd);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it on purpose the integration test only tests the process created with the Runtime class?
Since the ProcessBuilder has a own instrumentation class I would expect it to also have an integration test.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, Runtime.getRuntime().exec(...) delegates to ProcessBuilder, but that's an implementation detail.

As far as I know creating instances of Process is always done through ProcessBuilder.start, thus in this case I'd say that it's pretty safe.

However, supporting java9 ProcessHandler for example would require to have a different code here to start and wait for process termination.

@SylvainJuge
Copy link
Copy Markdown
Author

I've added support for commons-exec, thus your use-cases should be fully covered now.

I think that capturing parameters and exit value should be easier to do in separate PRs when this plugin is merged to master in order to avoid keeping this PR open for too long.

@theobisproject
Copy link
Copy Markdown
Owner

Everything works now. Thanks again for taking over and make the instrumentation work!
I'll merge your changes and rebase against master so the changes can be integrated.

@theobisproject theobisproject merged commit 550d698 into theobisproject:binary-execution-support Dec 7, 2019
@SylvainJuge SylvainJuge deleted the binary-execution-support branch December 9, 2019 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants