Description
Search before asking
- I searched in the issues and found nothing similar.
Read release policy
- I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
Version
3.2.2
Minimal reproduce step
Issue Description:
In the Pulsar-Shell environment, when a user presses Ctrl-C during a shell operation to terminate the running shell operation, an exception org.apache.pulsar.shell.PulsarShell$InterruptShellException
occurs but it does not terminate the running shell operation, it prints the below stack trace and the current execution keeps on running. Ideally, it should terminate the current execution.
^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)
To reproduce it locally:
- Run pulsar in standalone mode.
- Start pulsar-shell using
./bin/pulsar-shell
- Run some command for example,
client produce my-topic -m "my-msg" -n 1000
orclient consume -s s1 my-topic -n 1000
- Then try to press Ctrl+C immediately. The expected behaviour should be that it terminate the above command immediately and return to the shell terminal. But it will print the above stack trace instead and keeps running the command till it finishes producing 1000 messages or till it finishes consuming 1000 messages respectively.
What did you expect to see?
When the user presses Ctrl-C to terminate the currently running shell operation it should terminate the current execution and return to the shell terminal.
What did you see instead?
On pressing Ctrl-C during a shell operation, the current shell operation keeps on running. In addition, it also 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)
Anything else?
This PR is related which fixes #19218.
Are you willing to submit a PR?
- I'm willing to submit a PR!