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.6 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_HELO_NONE,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 79CC31F461 for ; Thu, 22 Aug 2019 11:28:41 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 03D38120ABE; Thu, 22 Aug 2019 20:28:34 +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 A6320120A84 for ; Thu, 22 Aug 2019 20:28:32 +0900 (JST) Received: by filter0079p3mdw1.sendgrid.net with SMTP id filter0079p3mdw1-4985-5D5E7C64-25 2019-08-22 11:28:36.538803903 +0000 UTC m=+409947.831725003 Received: from herokuapp.com (unknown [54.226.103.57]) by ismtpd0023p1iad2.sendgrid.net (SG) with ESMTP id xGpBfew0Q5qdUthnj_56Vg for ; Thu, 22 Aug 2019 11:28:36.410 +0000 (UTC) Date: Thu, 22 Aug 2019 11:28:36 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70027 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15992 X-Redmine-Issue-Author: naruse 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=2FCtwTyLnb16kXFhKv6RW7?= =?us-ascii?Q?m8rrGRAmzlHFWNLrjvPO7KforQm4aFmV9e=2FW5Fh?= =?us-ascii?Q?zxrGbZxSrtUXZkcwulOHv3MAztnucQQHmt=2Fh3f8?= =?us-ascii?Q?KwyAvJ5j58jMJe5sOoqds7qJvBwWbQwCcmropsx?= =?us-ascii?Q?x5uVIHv=2FrQ6z6QdDOVZ+yqxcbLN=2FgJETgNQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 94478 Subject: [ruby-core:94478] [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 nagachika (Tomoyuki Chikanaga). Backport changed from 2.5: REQUIRED, 2.6: REQUIRED to 2.5: REQUIRED, 2.6: DONE ruby_2_6 r67749 merged revision(s) 9557069299ac3b96691040a541afa65761a724ad. ---------------------------------------- Bug #15992: An exception breaks monitor state and cause deadlock https://bugs.ruby-lang.org/issues/15992#change-80913 * Author: naruse (Yui NARUSE) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.5: REQUIRED, 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/