-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-20854: Support low-overhead async profiling #4487
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
base: trunk
Are you sure you want to change the base?
Conversation
| # AsyncProfiler Flags | ||
| #-Dcassandra.async_profiler.enabled=true|false | ||
| #-Dcassandra.async_profiler.advanced_mode=true|false | ||
| #-Dcassandra.async_profiler.output_directory=/tmp/cassandra-profiling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the parameter is declared but not implemented, a logging directory probably is a better default location ...
|
|
||
| public interface AsyncProfilerMBean | ||
| { | ||
| void start(String event, String outputFormat, int timeout, String outputPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timeout - duration probably a better name for the parameter + a time unit as a a suffix would be helpful
outputPath - using a path is too dangerous from security point of view, a path to a data file or another file can be specified to cause a DoS (explicitly or using tricks like ../../.., so it is better to allow only a file name with explictly defined set of symbols to use (allowlist is safer than an denylist)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it at timeout, as it is what the actual async profiler is using.
For the outputPath, that makes sense. Changing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding timeout - yes, I mixed it up with -d option and what one is asprof option only.
| } | ||
| catch (Throwable t) | ||
| { | ||
| System.out.println("async-profiler initialization ERROR"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printing to out instead of using logging within Cassandra daemon
| { | ||
|
|
||
| private static AsyncProfilerService profiler; | ||
| private static String testOutputFile = "/tmp/test-profile.html"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use TemporaryFolder?
| @Before | ||
| public void setUp() | ||
| { | ||
| ASYNC_PROFILER_ENABLED.setBoolean(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use org.apache.cassandra.distributed.shared.WithProperties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the tests are needed that flag to be true. I think this setup helps with code duplication?
| } | ||
|
|
||
| @Test | ||
| public void testUnsafeExecute() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the goal of the test is not clear..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to set on stone that the safe profiler will fail with arbitrary commands.
| public class Profile extends AbstractCommand { | ||
|
|
||
| @Option(names = {"-s", "--start"}, description = "Start profiling") | ||
| public boolean start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should start/stop/raw be a subcommand? Or we need some another way to make the options exclusive, they are not used together based on the execute logic..
This is a follow up PR on top of
#4255