From owner-freebsd-ports-bugs@freebsd.org Thu Sep 7 01:18:20 2017 Return-Path: Delivered-To: freebsd-ports-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AD30E21896 for ; Thu, 7 Sep 2017 01:18:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC84B765FF for ; Thu, 7 Sep 2017 01:18:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v871IJ9J035462 for ; Thu, 7 Sep 2017 01:18:19 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 222112] lang/python36 selectors.select() does not block on named pipes / mkfifo Date: Thu, 07 Sep 2017 01:18:19 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: jeff+freebsd@wagsky.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: python@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2017 01:18:20 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D222112 Bug ID: 222112 Summary: lang/python36 selectors.select() does not block on named pipes / mkfifo Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: python@FreeBSD.org Reporter: jeff+freebsd@wagsky.com Assignee: python@FreeBSD.org Flags: maintainer-feedback?(python@FreeBSD.org) An instance of selectors.select() blocks as expected until data is ready on= a named pipe or a regular file. On FreeBSD 11.1-RELEASE-p1 it does not block after that data has been read from a named pipe (but does continue to block with a regular file).=20 This is both unexpected and inconsistent with at least behavior under Mac O= S X, which continues to block as expected with both a named pipe and a regular f= ile. Observed behavior: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * my_selectors.select() blocks as expected until data is written to the pipe * the data is read from the pipe * my_selectors.select() no longer blocks Expected behavior: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * my_selectors.select() would block until there was more data written to the pipe Same behavior is seen with the "default" selectors.KqueueSelector as well as with explicitly using a selectors.PollSelector (Mac OS X default). Impact: =3D=3D=3D=3D=3D=3D=3D * No clear way to use select from Python to "read when ready" from a named = pipe * Programs that rely on select may have very unexpected behavior Workarounds: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (none at this time) Environment: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D FreeBSD 11.1-RELEASE-p1 python3-3_3 python36-3.6.1_4 jailed or host system, same behavior venv or not, same behavior To replicate: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (warning, this will spew to the terminal until interrupted if commands-in i= s a named pipe) $ rm commands-in $ mkfifo commands-in (run the program, below) $ echo "Something" >> commands-in # ">" also fails using 'touch' to obtain a regular file will demonstrate the regular-file behavior key_event_list is retained for visibility in debugger timeout=3DNone is the default, made explicit to confirm not the issue "If timeout is None, the call will block until a monitored file object beco= mes ready.=E2=80=8B" See also https://forums.freebsd.org/threads/62377/ Example Python 3 code follows: import logging import selectors def test(): command_pipe =3D 'commands-in' logging.basicConfig(level=3Dlogging.INFO) logger =3D logging.getLogger() logger.info(f"Opening command pipe: '{command_pipe}'") with open(command_pipe, 'r') as cp: select_cp =3D selectors.DefaultSelector() select_cp.register(cp, selectors.EVENT_READ) while True: key_event_list =3D select_cp.select(timeout=3DNone) line =3D cp.readline() logger.info(f"Read: '{line}'") if __name__ =3D=3D '__main__': --=20 You are receiving this mail because: You are the assignee for the bug.=