From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id A176B1F87F for ; Thu, 22 Nov 2018 15:39:18 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1742B121272; Fri, 23 Nov 2018 00:39:15 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 71B251216DE for ; Fri, 23 Nov 2018 00:39:12 +0900 (JST) Received: by filter0132p3las1.sendgrid.net with SMTP id filter0132p3las1-23421-5BF6CD9D-2 2018-11-22 15:39:09.108863894 +0000 UTC m=+588024.629641785 Received: from herokuapp.com (ec2-54-81-117-10.compute-1.amazonaws.com [54.81.117.10]) by ismtpd0040p1mdw1.sendgrid.net (SG) with ESMTP id 5mKO7F_0R_6Y6vHcj6D6fg Thu, 22 Nov 2018 15:39:08.904 +0000 (UTC) Date: Thu, 22 Nov 2018 15:39:09 +0000 (UTC) From: Greg.mpls@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 65376 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 14968 X-Redmine-Issue-Author: normalperson X-Redmine-Sender: MSP-Greg X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6XfE4uVxwKhx2f9ZbFoUxFz4xp3R5dbEhcwh q30OqegXScE+ZgVQqfoR4BPmz2ipXe4CL9dPobu/i7R43hJ0Oodv9WEWoGRw8k2qGkCmd9Ka3ynBmR RrGF3ix3ExMIq38lhWgq/iTUeA7u83bAh8BOzgaApvwDtu0WmbkxTiMNEA== X-ML-Name: ruby-core X-Mail-Count: 89977 Subject: [ruby-core:89977] [Ruby trunk Bug#14968] [PATCH] io.c: make all pipes nonblocking by default X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #14968 has been updated by MSP-Greg (Greg L). Further testing (net, openssl, & socket): ``` 1) Error: TestSocket#test_udp_recv_truncation: Errno::EMSGSIZE: A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. - recvfrom(2) C:/Greg/GitHub/ruby/test/socket/test_socket.rb:712:in `recv' C:/Greg/GitHub/ruby/test/socket/test_socket.rb:712:in `test_udp_recv_truncation' 2) Error: TestSocket#test_udp_recvmsg_truncation: Errno::EMSGSIZE: A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. - recvmsg(2) C:/Greg/Ruby99-x64_bad_27/lib/ruby/2.6.0/socket.rb:427:in `__recvmsg' C:/Greg/Ruby99-x64_bad_27/lib/ruby/2.6.0/socket.rb:427:in `recvmsg' C:/Greg/GitHub/ruby/test/socket/test_socket.rb:728:in `test_udp_recvmsg_truncation' 3) Error: TestSocket#test_udp_read_truncation: Errno::EMSGSIZE: A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. C:/Greg/GitHub/ruby/test/socket/test_socket.rb:698:in `read' C:/Greg/GitHub/ruby/test/socket/test_socket.rb:698:in `test_udp_read_truncation' ``` Also, some of the TestNetHTTPS tests timeout. All the above tests passed on r65909. Thanks, Greg ---------------------------------------- Bug #14968: [PATCH] io.c: make all pipes nonblocking by default https://bugs.ruby-lang.org/issues/14968#change-75083 * Author: normalperson (Eric Wong) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Crap, I always planned to have something like this for [Feature #13618] (auto-Fiber); but introducing a race condition for Timer-thread elimination in [Misc #14937] forced me to introduce this early. Anyways, I might have to revert and reintroduce timer-thread if this change is unnacceptable :< (I HATE timer thread) ``` io.c: make all pipes nonblocking by default All normal Ruby IO methods (IO#read, IO#gets, IO#write, ...) are all capable of appearing to be "blocking" when presented with a file description with the O_NONBLOCK flag set; so there is little risk of incompatibility within Ruby-using programs. The biggest compatibility risk is when spawning external programs. As a result, stdin, stdout, and stderr are now always made blocking before exec-family calls. Timer-thread elimination in https://bugs.ruby-lang.org/issues/14937 introduced a race condition in signal handling. It is possible to receive a signal inside BLOCKING_REGION right before read/write syscalls. If this patch cannot be accepted, I will have to revert to reintroduce timer-thread and increase resource use (which led to other failures in the past). The race condition introduced for [Misc #14937] led to rare CI failures on a few tests: - test/ruby/test_thread.rb (test_thread_timer_and_interrupt): http://www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20180805T080500Z.fail.html.gz - test/ruby/test_io.rb (test_race_gets_and_close): http://ci.rvm.jp/results/trunk@P895/1190369 This change is ALSO necessary to take advantage of (proposed lightweight concurrency (aka "auto-Fiber") or any similar proposal: https://bugs.ruby-lang.org/issues/13618 TODO: all sockets and FIFOs non-blocking by default, too ``` ---Files-------------------------------- 0001-io.c-make-all-pipes-nonblocking-by-default.patch (12.1 KB) -- https://bugs.ruby-lang.org/