Linux – Why would bash commands sometimes not return output

bashlinuxredhat-enterprise-linux

In a bash shell, if I execute any command (e.g. "who"), many times it will not show any results, but when I next execute any other command the output of the previous command will be included.

e.g.:

    > who
    > ls -l
    u811217  pts/0        Jul  7 10:36 (pcp830738pcs.ny.abc.com)
    f122260  pts/1        Jun 29 18:07 (wnnypbh82bqjl1.ny.abc.com)
    hpmonpd  pts/2        Jul  6 15:17 (vsin0vw342.svr.us.abc.net)
    total 10536
    -rwxr--r-x  1 e252642 pbdvdp      75 Jul  6 12:26 runboth.sh
    -rwxr--r-x  1 e252642 pbdvdp      19 Jul  6 12:28 runtop.sh
    -rwxr--r-x  1 e252642 pbdvdp     108 Jul  6 12:29 runvmstat.sh

At first it looks like some sort of "not flushing the buffer" issue, but sometimes the results are received out of order:
e.g.:

    > who
    > ls -l
    total 10536
    -rwxr--r-x  1 e252642 pbdvdp      75 Jul  6 12:26 runboth.sh
    -rwxr--r-x  1 e252642 pbdvdp      19 Jul  6 12:28 runtop.sh
    -rwxr--r-x  1 e252642 pbdvdp     108 Jul  6 12:29 runvmstat.sh
    u811217  pts/0        Jul  7 10:36 (pcp830738pcs.ny.abc.com)
    f122260  pts/1        Jun 29 18:07 (wnnypbh82bqjl1.ny.abc.com)
    hpmonpd  pts/2        Jul  6 15:17 (vsin0vw342.svr.us.abc.net)

Other notes of interest are:

  • I cannot get this behavior to happen for built-in bash commands, like 'history' or 'dirs'.
  • I cannot get this behavior to happen using 'ksh'.

This simple case is given as an example. The problem happens with file redirects, etc., and is causing major problems when it happens inside critical scripts that are executed.

OS details: redhat linux 2.6.9-67.0.4.ellargesmp

Any help or suggestions would be greatly appreciated.
Thanks.

Best Answer

Thanks for the help. It looks like the culprit was a process that had a memory leak of threads, with the count reaching 25,000+. So many things are weird about this problem that I don't know where to start. e.g. 'ksh' worked fine...

Anyway, a patch was released, the thread count is back in the couple hundreds, and so far no weird behavior.

Thanks, Bruce

Related Question