mirror of https://github.com/apache/kafka.git
KAFKA-18343: Use java_pids to implement pids (#18312)
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 <jolshan@confluent.io>
This commit is contained in:
parent
649cd6b42c
commit
4567f39825
|
@ -951,9 +951,7 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
|
||||||
def pids(self, node):
|
def pids(self, node):
|
||||||
"""Return process ids associated with running processes on the given node."""
|
"""Return process ids associated with running processes on the given node."""
|
||||||
try:
|
try:
|
||||||
cmd = "ps ax | grep -i %s | grep -v grep | awk '{print $1}'" % self.java_class_name()
|
return node.account.java_pids(self.java_class_name())
|
||||||
pid_arr = [pid for pid in node.account.ssh_capture(cmd, allow_fail=True, callback=int)]
|
|
||||||
return pid_arr
|
|
||||||
except (RemoteCommandError, ValueError) as e:
|
except (RemoteCommandError, ValueError) as e:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -1935,4 +1933,4 @@ class KafkaService(KafkaPathResolverMixin, JmxMixin, Service):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def java_class_name(self):
|
def java_class_name(self):
|
||||||
return "kafka.Kafka"
|
return "kafka\.Kafka"
|
||||||
|
|
Loading…
Reference in New Issue