MINOR: ensure ps output is unlimited width - #22990
Open
gaurav-narula wants to merge 1 commit into
Open
Conversation
`kafka-server-stop.sh` uses `ps` to figure out Kafka's pid. This fails when the command is long which may happen due to classpath being passed as the args to the java command. This change adds the `ww` flag which ensures no limits are put on `ps`' output. It also changes `jvm/Dockerfile` to use `ps` from `procps-ng` package as the `ps` implementation that ships in busybox limits the output to a max of `2048` characters [0]. [0]: https://github.com/mirror/busybox/blob/371fe9f71d445d18be28c82a2a6d82115c8af19d/procps/ps.c#L679
gaurav-narula
commented
Jul 29, 2026
| PIDS=$(ps -Af | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $2}') | ||
| else | ||
| PIDS=$(ps ax | grep ' kafka\.Kafka ' | grep java | grep -v grep | awk '{print $1}'| xargs) | ||
| PIDS=$(ps axww | grep ' kafka\.Kafka ' | grep java | grep -v grep | awk '{print $1}'| xargs) |
Contributor
Author
There was a problem hiding this comment.
For posterity, w flag has been accepted as a part of POSIX: https://austingroupbugs.net/view.php?id=905
chia7712
reviewed
Aug 1, 2026
| apk update ; \ | ||
| apk upgrade ; \ | ||
| apk add --no-cache bash; \ | ||
| apk add --no-cache bash procps-ng; \ |
Member
There was a problem hiding this comment.
Why modify build-jsa? Since it's a temporary layer, I believe you meant to apply this fix at line 75
Contributor
Author
There was a problem hiding this comment.
It's because build-jsa layer runs jsa_launch which in turn runs kafka-server-stop.sh
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.
kafka-server-stop.shusespsto figure out Kafka's pid. This fails when the command is long which may happen due to classpath being passed as the args to the java command.This change adds the
wwflag which ensures no limits are put onps' output. It also changesjvm/Dockerfileto usepsfromprocps-ngpackage as thepsimplementation that ships in busybox limits the output to a max of2048characters 0.Reviewers: Chia-Ping Tsai chia7712@gmail.com