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.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham 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 2035E1F461 for ; Mon, 26 Aug 2019 17:04:01 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9786A120B75; Tue, 27 Aug 2019 02:03:51 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 8A584120B35 for ; Tue, 27 Aug 2019 02:03:49 +0900 (JST) Received: by filter0035p3las1.sendgrid.net with SMTP id filter0035p3las1-11343-5D6410F5-3E 2019-08-26 17:03:49.528677625 +0000 UTC m=+560.307585251 Received: from herokuapp.com (unknown [54.242.199.255]) by ismtpd0047p1mdw1.sendgrid.net (SG) with ESMTP id VwigjzmeT3KUVwrkPRN7FA for ; Mon, 26 Aug 2019 17:03:49.387 +0000 (UTC) Date: Mon, 26 Aug 2019 17:03:49 +0000 (UTC) From: usa@garbagecollect.jp Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70135 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15992 X-Redmine-Issue-Author: naruse X-Redmine-Sender: usa 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?9Ij0W+xF+66shKwcOf8RvdqxJGkEJjaCZuueI4cieuDPtXRMDeP2=2FE1P3xE3z3?= =?us-ascii?Q?WN8gdC+GEeNh8kazYxb=2F2T6WFMaSVzLVAfPQAAR?= =?us-ascii?Q?SsA+q7bVjQ9=2F1TTE9sBrE4ixLNnDUt4ZeBo98XB?= =?us-ascii?Q?EpGFfF3Qe7v7RNmHWCIbtxWtMDTiUd20ln9Nz07?= =?us-ascii?Q?riICzPZTDknMqIBdGhWZSq4OJn9qXHNmXbA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 94583 Subject: [ruby-core:94583] [Ruby master Bug#15992] An exception breaks monitor state and cause deadlock 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 #15992 has been updated by usa (Usaku NAKAMURA). Backport changed from 2.5: REQUIRED, 2.6: DONE to 2.5: DONE, 2.6: DONE ruby_2_5 r67774 merged revision(s) f91879a7b548284c93743168acfd11e3d2aeefac,9557069299ac3b96691040a541afa65761a724ad. ---------------------------------------- Bug #15992: An exception breaks monitor state and cause deadlock https://bugs.ruby-lang.org/issues/15992#change-81046 * Author: naruse (Yui NARUSE) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.5: DONE, 2.6: DONE ---------------------------------------- lib/monitor.rb provides Monitor. But its state handling is weak for interrupts caused by Thread.kill for example timeout libraries. Timeout exception may happen everywhere. If it raised when the thread is executing ```ruby def mon_exit mon_check_owner @mon_count -=1 if @mon_count == 0 @mon_owner = nil # HERE!!! @mon_mutex.unlock end end ``` It breaks the state of the monitor and it causes deadlock. -- https://bugs.ruby-lang.org/