You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kudu.apache.org by "Adar Dembo (Code Review)" <ge...@cloudera.org> on 2016/05/02 14:24:40 UTC

[kudu-CR] net_util: update address-in-use collision check for lsof 4.89

Hello Todd Lipcon,

I'd like you to do a code review.  Please visit

    http://gerrit.cloudera.org:8080/2921

to review the following change.

Change subject: net_util: update address-in-use collision check for lsof 4.89
......................................................................

net_util: update address-in-use collision check for lsof 4.89

Version 4.89 has changed how lsof handles output when -F is provided. Now,
the file descriptor is always selected, which means if we don't filter it
out, we'll end up with the following output:

  adar@adar-ThinkPad-T540p:~/Source/kudu/build/debug$ lsof -n -i 'TCP:43540' -sTCP:LISTEN ; for pid in $(lsof -F p -n -i 'TCP:43540' -sTCP:LISTEN | cut -f 2 -dp) ; do while [ $pid -gt 1 ] ; do ps h -fp $pid ; stat=($(</proc/$pid/stat)) ; pid=${stat[3]} ; done ; done
  COMMAND   PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
  java    15955 adar   97u  IPv6 4668514      0t0  TCP 127.0.0.1:43540 (LISTEN)
  adar     15955 15643  1 Apr28 ?        Sl    74:47 /usr/bin/java -Dosgi.requiredJavaVersion=1.7 -XX:MaxPermSize=256m -
  adar     15643  2944  0 Apr28 ?        Sl     0:00 /opt/eclipse/eclipse
  adar      2944  1650  0 Apr26 ?        Ss     0:00 /sbin/upstart --user
  root      1650  1484  0 Apr26 ?        Sl     0:00 lightdm --session-child 12 19
  root      1484     1  0 Apr26 ?        SLsl   0:00 /usr/sbin/lightdm
  bash: [: f97: integer expression expected

Adding a 'grep p' to the pipeline filters out the file descriptor, and is a
no-op with an older lsof (where the file descriptor is not selected).

Change-Id: Id687fc40c7de09465da1b6b2ba16f2befa93f2e1
---
M src/kudu/util/net/net_util.cc
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/21/2921/1
-- 
To view, visit http://gerrit.cloudera.org:8080/2921
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id687fc40c7de09465da1b6b2ba16f2befa93f2e1
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>