Repository navigation
[fix][common] Fix issue where logs get truncated when Runtime.halt is used to terminate the process - #17589
Merged
Conversation
…gets terminated with Runtime.halt - call Log4j2's LogManager.shutdown before terminating the process with Runtime.halt
1 of 4 tasks
merlimat
reviewed
Sep 12, 2022
michaeljmarshall
approved these changes
Sep 13, 2022
michaeljmarshall
left a comment
Member
There was a problem hiding this comment.
I agree with @merlimat's comment. Otherwise, LGTM.
Member
Author
@michaeljmarshall @merlimat I addressed the review feedback. PTAL |
Contributor
|
@lhotari |
1 of 2 tasks
tisonkun
reviewed
Dec 9, 2022
Comment on lines
+52
to
+53
| log.warn("Triggering immediate shutdown of current process with status {}", status, | ||
| new Exception("Stacktrace for immediate shutdown")); |
Member
There was a problem hiding this comment.
@lhotari recently I found that this warning can be annoying or misleading. Said if we run a command ./bin/pulsar-admin schemas delete so that it gives the usage info. The user will found:
$ ./bin/pulsar-admin schemas delete
Main parameters are required ("persistent://tenant/namespace/topic")
Delete the latest schema for a topic
Usage: delete [options] persistent://tenant/namespace/topic
Options:
-f, --force
whether to delete schema completely. If true, delete all resources
(including metastore and ledger), otherwise only do a mark deletion and
not remove any resources indeed
Default: false
2022-12-09T15:39:22,850+0800 [main] WARN org.apache.pulsar.common.util.ShutdownUtil - Triggering immediate shutdown of current process with status 1
java.lang.Exception: Stacktrace for immediate shutdown
at org.apache.pulsar.common.util.ShutdownUtil.triggerImmediateForcefulShutdown(ShutdownUtil.java:52) ~[pulsar-common.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.admin.cli.PulsarAdminTool.exit(PulsarAdminTool.java:309) ~[pulsar-client-tools.jar:2.11.0-SNAPSHOT]
at org.apache.pulsar.admin.cli.PulsarAdminTool.main(PulsarAdminTool.java:300) ~[pulsar-client-tools.jar:2.11.0-SNAPSHOT]
and confused.
Perhaps we remove this logging line or change it to debug level?
Closed
1 of 2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17587
Motivation
Pulsar log file might not contain the last few log lines when the Pulsar process is abnormally terminated with Runtime.halt.
Modifications
ShutdownUtil.triggerImmediateForcefulShutdownwhich calls Log4j2's LogManager.shutdown before terminating the process with Runtime.haltRuntime.haltwithShutdownUtil.triggerImmediateForcefulShutdownin the Pulsar code baseDocumentation
doc-required(Your PR needs to update docs and you will update later)
doc-not-needed(Please explain why)
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)