Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
1  
How do you open the shell? (console, xterm or another terminal emulator, SSH, telnet...) What do tty and readlink /proc/self/fd/0 output? –  grawity Jul 7 '11 at 15:24
    
We open the terminal using Putty(SSH). tty returns "/dev/pts/5". Also, many users have experienced this issue, most likely all using Putty(SSH). –  Bruce Jul 7 '11 at 15:55
    
I think you have two processes both reading from stdin. –  Soren Jul 7 '11 at 19:44
    
The fact that that's the default bash $PS2 prompt is a bit of a clue, I'd say. –  JdeBP Jul 7 '11 at 20:00
    
@JdeBP: Please ignore the prompt. At the time I added this question the problem was not happening so I hand-typed the example. The problem will not appear for hours, then work properly for hours, then reappear for hours. (For me, I manually set the PS1 prompt because I don't have a home dir on these production servers.) –  Bruce Jul 8 '11 at 6:07

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.