This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.18.x
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/branch-1.18.x by this push:
     new 8cb2bd585 [util] omit '-b' option from lsof's invocations
8cb2bd585 is described below

commit 8cb2bd585ac1a2384c2d518a185c546c2f6f520c
Author: Alexey Serbin <[email protected]>
AuthorDate: Thu Jan 23 09:36:08 2025 -0800

    [util] omit '-b' option from lsof's invocations
    
    I haven't checked for the reason behind this, but at least with kernel
    6.8.0 on Ubuntu 24.04.1 LTS, lsof doesn't list TCP sockets when running
    with '-b' option (lsof version 4.95.0) like below:
      lsof -wbnP -Fpfn -a -i 4TCP -p <pid>
    
    Both TCP and UDP sockets are listed as expected when not adding
    the '-b' option into the lsof's command line.
    
    Removing the '-b' option shouldn't be a big deal since nothing
    in the upstream CI pipeline runs on machines with NFS mounts or other
    types of stale mounts that would block lstat(), readlink(), or stat()
    system calls [1].  In any case, even if a process running as a part
    of Kudu test scaffolding opens filesystem objects on a NFS mount,
    the result of the test isn't quite predictable when the NFS mount
    stalls, regardless of the lsof's behavior.
    
    [1] https://www.man7.org/linux/man-pages/man8/lsof.8.html
    
    Change-Id: I73490a8f73728434292c5ee6f175eed63523ffd4
    Reviewed-on: http://gerrit.cloudera.org:8080/22380
    Tested-by: Kudu Jenkins
    Reviewed-by: Abhishek Chennaka <[email protected]>
    (cherry picked from commit ec07c9f6ace749d08c6fc30015478f973442be5c)
    Reviewed-on: http://gerrit.cloudera.org:8080/22385
    Tested-by: Alexey Serbin <[email protected]>
---
 src/kudu/client/client_examples-test.sh | 2 +-
 src/kudu/util/test_util.cc              | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/kudu/client/client_examples-test.sh 
b/src/kudu/client/client_examples-test.sh
index 66ea5b94c..c8f5a6267 100755
--- a/src/kudu/client/client_examples-test.sh
+++ b/src/kudu/client/client_examples-test.sh
@@ -60,7 +60,7 @@ wait_for_listen_port() {
       return 1
     fi
     local ports
-    ports=$(lsof -wbnP -Fn -p "$pid" -a -i 4TCP -a -s TCP:LISTEN | \
+    ports=$(lsof -wnP -Fn -p "$pid" -a -i 4TCP -a -s TCP:LISTEN | \
             sed -n '/^n/ s/^[^:].*://p')
     for i in $ports; do
       if [[ $i -eq $expected_port ]]; then
diff --git a/src/kudu/util/test_util.cc b/src/kudu/util/test_util.cc
index b6e5512da..72b3465b1 100644
--- a/src/kudu/util/test_util.cc
+++ b/src/kudu/util/test_util.cc
@@ -474,7 +474,7 @@ Status WaitForBind(pid_t pid,
   RETURN_NOT_OK(FindExecutable("lsof", {"/sbin", "/usr/sbin"}, &lsof));
 
   const vector<string> cmd = {
-    lsof, "-wbnP", "-Ffn",
+    lsof, "-wnP", "-Ffn",
     "-p", std::to_string(pid),
     "-a", "-i", kind
   };
@@ -558,7 +558,7 @@ Status WaitForBindAtPort(const vector<string>& addresses,
                          MonoDelta timeout) {
   string lsof;
   RETURN_NOT_OK(FindExecutable("lsof", {"/sbin", "/usr/sbin"}, &lsof));
-  const vector<string> cmd = { lsof, "-wbnP", "-Fpfn", "-a", "-i", kind };
+  const vector<string> cmd = { lsof, "-wnP", "-Fpfn", "-a", "-i", kind };
 
   // The '-Fpfn' flag gets lsof to output something like:
   //   p2133

Reply via email to