-
Notifications
You must be signed in to change notification settings - Fork 8
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
Print thread dump on specific signals #27
Print thread dump on specific signals #27
Conversation
5d1911d
to
5fe921d
Compare
@@ -93,11 +95,12 @@ public static final class Options extends GroupedOptions | |||
final OptionSimple hdrOutputFile = new OptionSimple("hdrfile=", ".*", null, "Log to a file", false); | |||
final OptionSimple interval = new OptionSimple("interval=", "[0-9]+(ms|s|)", "1s", "Log progress every <value> seconds or milliseconds", false); | |||
final OptionSimple level = new OptionSimple("level=", "(minimal|normal|verbose)", "normal", "Logging level (minimal, normal or verbose)", false); | |||
final OptionSimple printThreadDumpOnShutdown = new OptionSimple("print-thread-dump-on-shutdown", "", null, "Print local thread dump to the standard output on shutdown (normal, SIGTERM, SIGINT, SIGABRT).", false); |
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 will require additional code on dtest side to understand whethere given c-s support this option or not.
It would be better to just do that by default, but only if c-s
was terminated.
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.
Reworked to a version without new option.
import sun.misc.Signal; | ||
import sun.misc.SignalHandler; |
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.
Are the sun.misc.*
inside the internal
parts of JDK and shouldn't be accessed?
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.
Yes, but outside of shutdown hooks I don't know of a way to do this. If it ever gets removed I assume there will be something else for signal handling and in that case this change should be easy to port or ditch altogether since it does not go too deep.
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.
You are right, there is no other way to get to the Unix signals, and handle specific signal through Java Public APIs
@@ -88,6 +94,14 @@ private static int run(String[] arguments) | |||
return 1; | |||
} | |||
|
|||
if (settings.log.printThreadDumpOnShutdown) { | |||
Runtime.getRuntime().addShutdownHook(new Thread(() -> { | |||
System.out.println("Shutdown thread dump:"); |
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.
It should not print thread dump when it terminates in a regular way, only when it is terminated by signal
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.
Removed
Adds a signal handler that will print thread dump to standard output on the following signals: SIGABRT, SIGTERM, SIGINT.
5fe921d
to
67f8796
Compare
Removed shutdown hook. Switched to solution with only signal handler. Now no config options are needed and thread dump will be printed only on three mentioned signals. |
Co-authored-by: Dmitry Kropachev <dmitry.kropachev@gmail.com>
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com>
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6) # Conflicts: # defaults/docker_images/cassandra-stress/values_cassandra-stress.yaml
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6) # Conflicts: # defaults/docker_images/cassandra-stress/values_cassandra-stress.yaml
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6) # Conflicts: # defaults/docker_images/cassandra-stress/values_cassandra-stress.yaml
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6)
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6) # Conflicts: # defaults/docker_images/cassandra-stress/values_cassandra-stress.yaml
Main reason for version change: Using cassandra-stress 3.17 to mittigate - Switch to ReplicaOrdering.RANDOM for select LBPs [32](scylladb/cassandra-stress#32) Other Noticable Changes since the last version used in SCT: - Add support for hostname verification [31](scylladb/cassandra-stress#31) - Print thread dump on specific signals [27](scylladb/cassandra-stress#27) - Replace uninterruptible wait [26](scylladb/cassandra-stress#26) - Make it use DCAwareRoundRobinPolicy unless rack is provided [21](scylladb/cassandra-stress#21) - feature(docker): adding support for dependabot [19](scylladb/cassandra-stress#19) Signed-off-by: Dusan Malusev <dusan.malusev@scylladb.com> (cherry picked from commit 02997a6) # Conflicts: # defaults/docker_images/cassandra-stress/values_cassandra-stress.yaml
Adds a signal handler that will print thread dump to standard output on
the following signals: SIGABRT, SIGTERM, SIGINT.
Does not work for SIGKILL or other abrupt shutdowns.
Addresses #28