#265: Failure when fetching a file with wget
-------------------------+--------------------------------------------------
  Reporter:  toots       |       Owner:  admin      
      Type:  Bugs        |      Status:  new        
  Priority:  8           |   Milestone:  NEAR FUTURE
 Component:  Liquidsoap  |     Version:  0.9.0+svn  
Resolution:              |    Keywords:             
       Mac:  1           |       Linux:  1          
    Netbsd:  1           |       Other:  1          
   Freebsd:  1           |  
-------------------------+--------------------------------------------------

Comment(by mrpingouin):

 I was responsible for that code, I should comment it. For now, let me
 explain it here.

 You want to wait for a process, but no longer than {{{timeout}}} seconds.
 The solution uses {{{select}}} to wait no longer than expected. We create
 a pipe {{{(xR,xW)}}}, don't do anything with the input end, and wait for
 something to read on the output end: it never happens, except when the
 pipe is closed, i.e. the process terminated. Indeed, the pipe {{{xW}}} is
 still open in the child process, until it dies. If the select terminates
 because of the timeout, we get empty lists, and we kill the process. Then
 we can {{{wait}}} for it, it's almost instantaneous.

 The other pipe is a fresh one created for the stdin of the new process,
 just to avoid that it reads on liquidsoap's stdin.

 I like the idea of that solution. It does requires some non-trivial
 knowledge of unix, but it avoids a waiting loop.

 Now, the error that you got is raised by the {{{Unix.close xW}}}, and it's
 {{{EBADF}}}. The protocol resolvers are supposed to fail cleanly, without
 raising, so we should catch it. Still, I'm a bit surprised that it
 happened, we must be having an exotic situation here: as you said, this
 code dates back before 0.3.0 and never caused any problem. It is typical
 to close unused ends of a pipe, and I don't see how the descriptor freshly
 created could be invalid and not closable...

-- 
Ticket URL: <http://savonet.rastageeks.org/ticket/265#comment:2>
Savonet <http://savonet.rastageeks.org/>
Let's program our stream !
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Savonet-trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-trac

Reply via email to