[haiku-bugs] Re: [Haiku] #5076: cat /dev/urandom hangs the terminal after a while

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Sun, 21 Mar 2010 16:23:13 -0000

#5076: cat /dev/urandom hangs the terminal after a while
-----------------------------------+----------------------------------------
 Reporter:  jackburton             |       Owner:  jackburton    
     Type:  bug                    |      Status:  new           
 Priority:  normal                 |   Milestone:  R1            
Component:  Applications/Terminal  |     Version:  R1/Development
 Keywords:  gcc4 hybrid            |   Blockedby:                
 Platform:  All                    |    Blocking:                
-----------------------------------+----------------------------------------

Comment(by bonefish):

 Replying to [comment:2 jackburton]:
 > Replying to [comment:1 diver]:
 > > http://dev.haiku-os.org/ticket/2851#comment:10 could be related?
 >
 > Absolutely.
 > Should we decouple writing from that thread, Ingo ? (by passing the data
 to another thread which does the real writing?)

 I don't think this would help at all. I believe the main problem is that
 no one reads from the slave end of the TTY, so that its buffer runs full
 eventually. Moving the writing to another thread would at best delay the
 hang as long as it takes for the Terminal's internal write buffer to run
 full as well. The only option I see is to drop the writes, i.e. use non-
 blocking I/O. This would also solve the second issue, that in echo mode
 writes from the Terminal are echoed back to the TTY master, whose buffer
 could already be full.

 While using non-blocking I/O would prevent Terminal threads from hanging,
 the problem remains that Ctrl-C and friends still wouldn't work, since
 they are also writes to the TTY and would be dropped as well. I wonder how
 that works in Linux.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/5076#comment:3>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: