Skip to content

Commit

Permalink
Use pgrep to find the redpanda pid
Browse files Browse the repository at this point in the history
It seems like redpanda_pid can pick up false pids in the current grep
filtering approach. Use `pgrep` to not incorrectly pickup a command with
a command line arg of `redpanda`, which seems likely in our environments.

When debugging redpanda-data#11275, it seems like there is an apport process who's
pid is being picked up. Here's a process dump that includes the line.
There are no running redpanda processes, but checking for redpanda
processes times out, leading me to believe that this process is being
picked up.

In that case `stop_node` can fail if the node is already failed in CDT,
as this process is picked up.

```
[DEBUG - 2023-06-12 02:54:07,216 - redpanda - _log_node_process_state - lineno:2215]: root      136962 99.6  6.0 1587948 1452804 ?     R    02:53   0:49 /usr/bin/python3 /usr/shar
e/apport/apport -p136954 -s5 -c18446744073709551615 -d1 -P136954 -u0 -g0 -- !opt!redpanda_installs!head!libexec!redpanda
```

Fixes: redpanda-data#11275

Signed-off-by: Tyler Rockwood <[email protected]>
(cherry picked from commit 4a2985f)
  • Loading branch information
rockwotj authored and vbotbuildovich committed Jun 14, 2023
1 parent 7425723 commit 736f406
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/rptest/services/redpanda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,8 @@ def redpanda_pid(self, node):
# we need to look for redpanda pid. pids() method returns pids of both
# nodejs server and redpanda
try:
cmd = "ps ax | grep -i 'redpanda' | grep -v grep | grep -v 'version'| grep -v \"\[redpanda\]\" | awk '{print $1}'"
cmd = "pgrep --exact redpanda"

for p in node.account.ssh_capture(cmd,
allow_fail=True,
callback=int):
Expand Down

0 comments on commit 736f406

Please sign in to comment.