fcntl/ioctl and O_NONBLOCK

Ralf Hildebrandt hildeb at www.stahl.bau.tu-bs.de
Sat Nov 27 12:35:42 EST 1999


On 27 Nov 1999 17:06:18 GMT, Donn Cave <donn at oz.net> wrote:

>Right - if there's anything to read, you will read only that and
>not block.  (So of course you must always check how much you actually
>have read!)  Select tells you precisely that your I/O won't block,
>either because there's data to read or end of file.

Fine. My problem here is the following: I start a program (plot) and
feed it with random input data until it crashes. Output is irrelevant
to me, I need only know if it crashes or exit()'s.

On the shell:
% plot < t1 > /dev/null
Segmentation fault.

In my Python program, though: The program ran for a while and never
returned. It didn't crash, it didn't exit, nothing. It just sat there
status "sleep" (displayed top). It didn't consume cpu-time, either.

I figured I should empty fromchild (since the command above generates
8MB of output) from time to time. Then I came across the select()
problem. 

This is also fixed now, but now the popen3 Object generates about 1 MB
of output (which I read using select() and read()), and then it STILL
doesn't return. No crash, no exit. And once more, in top it says
"sleep" once more. 
Any ideas what's going on there?

>I guess - except of course, sockets are bi-directional, and pipes are
>one direction only.

One direction is sufficient for me.




More information about the Python-list mailing list