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=-2.8 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 1E4B920248 for ; Wed, 13 Mar 2019 00:00:01 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 17E8C1218D6; Wed, 13 Mar 2019 08:59:56 +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 03FEF1218D6 for ; Wed, 13 Mar 2019 08:59:53 +0900 (JST) Received: by filter0180p3mdw1.sendgrid.net with SMTP id filter0180p3mdw1-358-5C8847F9-9 2019-03-12 23:59:53.162734132 +0000 UTC m=+89071.186599626 Received: from herokuapp.com (unknown [54.196.67.112]) by ismtpd0036p1iad2.sendgrid.net (SG) with ESMTP id 7PJ-1Vi5SfmHrNgkncAWXw for ; Tue, 12 Mar 2019 23:59:53.036 +0000 (UTC) Date: Tue, 12 Mar 2019 23:59:53 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67253 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15013 X-Redmine-Issue-Author: normalperson X-Redmine-Sender: nagachika 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: =?us-ascii?Q?O2wxg26uOO6cft6GjkEp=2FGevTnH9lR=2FEdG60AX3F8=2FBhDNfFZwBrbnd1hcLglS?= =?us-ascii?Q?lBUb0hs4aKrRC94eH1TBPQHLEv44yJr4LOtjqI7?= =?us-ascii?Q?0xSxJeoYm05dujg7Z0h5qr8xvs3I+RdgMTLorLj?= =?us-ascii?Q?rzHqmP1tmrXsPECI+1YS9kFJNUrGGfI8zpBbhAl?= =?us-ascii?Q?9+sQbpykJjbF2gzch=2FvpaiJaAn7JI7joTQA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 91802 Subject: [ruby-core:91802] [Ruby trunk Bug#15013] thread_pthread.c: reinitialize ubf_list at fork 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 #15013 has been updated by nagachika (Tomoyuki Chikanaga). MEMO: backporting r64485 and r64635 cause some make test failures on my environment. I give up to fix these for just now. ``` #257 test_fork.rb:31:in `': begin r, w = IO.pipe if pid1 = fork w.close r.read(1) Process.kill("USR1", pid1) _, s = Process.wait2(pid1) s.success? ? :ok : :ng else r.close if pid2 = fork trap("USR1") { Time.now.to_s; Process.kill("USR2", pid2) } w.close Process.wait2(pid2) else w.close sleep 0.2 end exit true end rescue NotImplementedError :ok end #=> "ng" (expected "ok") [ruby-core:28924] stderr output is not empty bootstraptest.tmp.rb:13:in `kill': No such process (Errno::ESRCH) from bootstraptest.tmp.rb:13:in `block in
' from bootstraptest.tmp.rb:15:in `wait2' from bootstraptest.tmp.rb:15:in `
' test_fork.rb FAIL 1/5 #455 test_io.rb:87:in `block in ': at_exit { p :foo } megacontent = "abc" * 12345678 #File.open("megasrc", "w") {|f| f << megacontent } t0 = Thread.main Thread.new { sleep 0.001 until t0.stop?; Process.kill(:INT, $$) } r1, w1 = IO.pipe r2, w2 = IO.pipe t1 = Thread.new { w1 << megacontent; w1.close } t2 = Thread.new { r2.read; r2.close } IO.copy_stream(r1, w2) rescue nil w2.close r1.close t1.join t2.join #=> killed by SIGKILL (signal 9) (timeout) megacontent-copy_stream test_io.rb FAIL 1/9 FAIL 2/1201 tests failed ``` ---------------------------------------- Bug #15013: thread_pthread.c: reinitialize ubf_list at fork https://bugs.ruby-lang.org/issues/15013#change-77075 * Author: normalperson (Eric Wong) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED ---------------------------------------- thread_pthread.c: reinitialize ubf_list at fork It's possible for the ubf_list_head to be populated with dead threads at fork or the ubf_list_lock to be held, so reinitialize both at startup. And while we're at it, use a static initializer at startup to save a library call and kill some ifdef. ---Files-------------------------------- 0001-thread_pthread.c-reinitialize-ubf_list-at-fork.patch (2.46 KB) -- https://bugs.ruby-lang.org/