我在一个计算集群上工作,我有一个非常奇怪的 /usr/bin/env 行为......总之,它工作得非常慢。在头节点上:
$ time /usr/bin/env which
<which output>
real 0m0.025s
user 0m0.001s
sys 0m0.001s
在计算节点上:
$ qsub -I
qsub: waiting for job 176620.scyld.localdomain to start
qsub: job 176620.scyld.localdomain ready
-bash-3.2$ time which
<which output>
real 0m0.003s
user 0m0.000s
sys 0m0.003s
-bash-3.2$ time /usr/bin/env /usr/bin/which
<which output>
real 0m0.003s
user 0m0.000s
sys 0m0.003s
-bash-3.2$ time /usr/bin/env which
<which output>
real 5m0.003s
user 0m0.001s
sys 0m0.001s
ps ax报告这个:
12884 pts/3 S+ 0:00 /usr/bin/env which
打印使用横幅需要 5 分钟。任何想法为什么会发生这种情况?
编辑1:
关于哪个的附加信息:
-bash-3.2$ type -a which
which is /usr/bin/which
-bash-3.2$ file /usr/bin/which
/usr/bin/which: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped
-bash-3.2$ echo $PATH
/bin:/usr/bin:/home/gusev/.rvm/bin:/home/gusev/bin
编辑 2
我已经strace
,/usr/bin/env which
它卡在
execve("/bin/which", ["which"], [/* 47 vars */]
现在运行一个平原
/bin/which
也卡住了,但这个文件不存在:
-bash-3.2$ ls /bin/which
ls: /bin/which: No such file or directory
/bin
安装在 NFS 上:
-bash-3.2$ mount | grep bin
10.54.0.1:/bin on /bin type nfs (nolock,nonfatal)
10.54.0.1:/usr/bin on /usr/bin type nfs (nolock,nonfatal)
所以这可能是一个网络问题......
编辑3:
which which
工作得很好:
-bash-3.2$ time which which
/usr/bin/which
real 0m0.002s
user 0m0.000s
sys 0m0.002s
的输出strace -e trace=execve /usr/bin/env which
是
execve("/usr/bin/env", ["/usr/bin/env", "which"], [/* 47 vars */]) = 0
execve("/bin/which", ["which"], [/* 47 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/bin/which", ["which"], [/* 47 vars */]) = 0
<which output>
编辑4:
挂起时间总是 5 分钟。看起来这是某种默认值超时。