[Ecls-list] Hang opening named pipe?

Philipp Marek philipp at marek.priv.at
Sun Jan 15 08:28:03 UTC 2012


> Hmm, I do not know much about pipes. Inspecting a running ECL, I see that
> it does not hang in ECL, but in the C library: in open()
>
> Attaching to program: `/Users/jjgarcia/bin/ecl', process 49213.
> Reading symbols for shared libraries ++.. done
> 0x00007fff86e3543e in open ()
> (gdb) info threads
>   2                         0x00007fff86e8c99e in __sigwait ()
> * 1 "com.apple.main-thread" 0x00007fff86e3543e in open ()
> (gdb) bt
> #0  0x00007fff86e3543e in open ()
> #1  0x00000001000f71d4 in ecl_open_stream (fn=0x10311bf30, smm=smm_output,
> if_exists=0x1002167c8, if_does_not_exist=0x100216e90, byte_size=0,
> flags=256, external_format=0x100216b80) at file.d:4804
>
>
> Do you have any idea why this might happen? ECL is resolving the fifo name
> to a full path, btw. I do not know whether this might cause part of the
> problem.

I've had strace running on ECL, and got this:
    cl-user> (open "/tmp/a" :direction :output :if-exists :overwrite)
    open("/tmp/a", O_RDONLY

So apparently even with :direction :output the filename gets opened for read (perhaps to
see whether it already exists?) - and this hangs, as open() on a FIFO blocks until
there's a reader and a writer. (Yes, I've had a reader waiting.)


Anyway, IMO the file must be opened only _once_ - with appropriate O_ flags.
I think the various :if-exists flags can all be done via these flags.


Not only FIFOs, unix sockets and devices might give problems for occasional opens.
(Think about eg. opening the watchdog device, where you have to send a specific token
before closing - else the machine just reboots!)


Regards,

Phil






More information about the ecl-devel mailing list