This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: kqueue not reporting EOF under certain circumstances
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Volodymyr.Kostyrko
Priority: normal Keywords:

Created on 2010-08-13 18:47 by Volodymyr.Kostyrko, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.py Volodymyr.Kostyrko, 2010-08-13 18:47 select.kqueue test, reads data from stdin, reports kevents, exits on file end (?)
Messages (4)
msg113811 - (view) Author: Volodymyr Kostyrko (Volodymyr.Kostyrko) Date: 2010-08-13 18:47
This one is BSD related. FreeBSD 8.1.

This works:
# cat test.py | ./test.py
-1 684 32768 0 0
#

This hangs:
# ./test.py < file
-1 684 0 0 0

The difference is that in second case popped kevent lacks any data on EOF.
msg114432 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-20 17:14
I presume the first example should have been 
# cat file | ./test.py
or seceond should have been
# ./test.py < test.py
so that test.py gets same input on stdin in either case.

For other readers: kqueue and kevent are bsd-specific functions and classes in the select module. In the first output, 32786 (== 1 << 15) is the EOF flag missing in the second output.

I wonder is this is really a python issue. I would expect that kqueue and kevent are thin wrappers for the os calls and objects and that python should be indifferent to the source of stdin data. You could check the C source. I do not know if there are any developers currently familiar with the innards of bsd.
msg114479 - (view) Author: Volodymyr Kostyrko (Volodymyr.Kostyrko) Date: 2010-08-21 05:25
Ok, I'll try to ask FreeBSD developers, too bad I'm not that familiar with C to write example other way than test if it's a system problem.
msg165695 - (view) Author: Volodymyr Kostyrko (Volodymyr.Kostyrko) Date: 2012-07-17 10:24
I was wrong. The current behavior is correct. The difference between execution is a difference between pipe file object and vnode file object. vnode backed file objects doesn't send any signals and care should be taken to detect file position.
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53800
2012-07-17 10:24:07Volodymyr.Kostyrkosetstatus: open -> closed
resolution: not a bug
messages: + msg165695
2010-08-21 05:25:49Volodymyr.Kostyrkosetnosy: - terry.reedy
messages: + msg114479
2010-08-20 17:14:37terry.reedysetnosy: + terry.reedy
messages: + msg114432
2010-08-13 18:53:03Volodymyr.Kostyrkosettitle: kqueu not reporting EOF under certain circumstances -> kqueue not reporting EOF under certain circumstances
2010-08-13 18:47:22Volodymyr.Kostyrkocreate