Skip to content

Commit

Permalink
KAFKA-18343: Use java_pids to implement pids (#18312)
Browse files Browse the repository at this point in the history
Related to KAFKA-18343,

Currently, there is an issue that the ps ax output is truncated, which causes the Kafka process ID to be unavailable. This issue can be mitigated by replacing ps ax with jcmd (i.e. using java_pids in ducktape), as it does not suffer from the truncation problem.

Reviewers: Justine Olshan <[email protected]>
  • Loading branch information
brandboat authored Dec 24, 2024
1 parent 649cd6b commit 4567f39
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/kafkatest/services/kafka/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,7 @@ def run_features_command(self, op, feature, new_version):
def pids(self, node):
"""Return process ids associated with running processes on the given node."""
try:
cmd = "ps ax | grep -i %s | grep -v grep | awk '{print $1}'" % self.java_class_name()
pid_arr = [pid for pid in node.account.ssh_capture(cmd, allow_fail=True, callback=int)]
return pid_arr
return node.account.java_pids(self.java_class_name())
except (RemoteCommandError, ValueError) as e:
return []

Expand Down Expand Up @@ -1935,4 +1933,4 @@ def get_offset_shell(self, time=None, topic=None, partitions=None, topic_partiti
return output

def java_class_name(self):
return "kafka.Kafka"
return "kafka\.Kafka"

0 comments on commit 4567f39

Please sign in to comment.