Skip to content
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

pulsar-shell CTRL-C during shell operation should not print stacktrace #22655

Open
2 tasks done
mukesh154 opened this issue May 6, 2024 · 0 comments
Open
2 tasks done
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Comments

@mukesh154
Copy link
Contributor

mukesh154 commented May 6, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

In the Pulsar-Shell of 3.2.2, an exception specifically org.apache.pulsar.shell.PulsarShell$InterruptShellException occurs, disrupting the execution flow when a user presses Ctrl-C during shell operation and it prints the below stack trace.

^CException in thread "SIGINT handler" org.apache.pulsar.shell.PulsarShell$InterruptShellException
	at org.apache.pulsar.shell.PulsarShell.lambda$run$2(PulsarShell.java:230)
	at org.jline.terminal.impl.AbstractTerminal.raise(AbstractTerminal.java:89)
	at org.jline.terminal.impl.PosixSysTerminal.lambda$handle$1(PosixSysTerminal.java:65)
	at org.jline.utils.Signals.lambda$register$1(Signals.java:53)
	at jdk.proxy2/jdk.proxy2.$Proxy3.handle(Unknown Source)
	at jdk.unsupported/sun.misc.Signal$InternalMiscHandler.handle(Signal.java:198)
	at java.base/jdk.internal.misc.Signal$1.run(Signal.java:219)
	at java.base/java.lang.Thread.run(Thread.java:840)

Solution

The problem is to simply NOT log the the full stack trace. To deal with this interruption smoothly, developers can use special tools for handling problems. They can wrap specific parts of their code in a safety net called a try-catch structure. This helps them catch and deal with the issue caused by pressing Ctrl-C, without showing all the confusing details(stack trace). Instead, they can show just print a message stating that the shell operation is interrupted.

Alternatives

No response

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@mukesh154 mukesh154 added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

No branches or pull requests

1 participant