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.9 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 374FB1F87F for ; Mon, 19 Nov 2018 00:52:37 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A3BE8121025; Mon, 19 Nov 2018 09:52:34 +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 F41E4120E37 for ; Mon, 19 Nov 2018 09:52:31 +0900 (JST) Received: by filter0163p3mdw1.sendgrid.net with SMTP id filter0163p3mdw1-16536-5BF2094B-11 2018-11-19 00:52:27.619542424 +0000 UTC m=+274617.118708247 Received: from herokuapp.com (ec2-54-145-8-172.compute-1.amazonaws.com [54.145.8.172]) by ismtpd0006p1iad1.sendgrid.net (SG) with ESMTP id cTl4qcL1TaKQdQXFdPdPcA for ; Mon, 19 Nov 2018 00:52:27.626 +0000 (UTC) Date: Mon, 19 Nov 2018 00:52:27 +0000 (UTC) From: takashikkbn@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 65250 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15316 X-Redmine-Issue-Author: normalperson X-Redmine-Issue-Assignee: k0kubun X-Redmine-Sender: k0kubun 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS4bCQK9uqLpHnLeLrOU4j8RXsOA8fZknlbj/5 IVI9Omt/6c0jkSclzISC1YWiYsSbDpAMyYnBPYFDCOKGppwzNv9nQpy/H6zWGi1YxVD8Db5eqCCZR1 LIKvTElwCBDHX9PAaGT8S3B3ayfUNgHbpLZTEOAONUjYCPxLXqGM0d4XSA== X-ML-Name: ruby-core X-Mail-Count: 89860 Subject: [ruby-core:89860] [Ruby trunk Bug#15316] rb_postponed_job_register not thread-safe 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 #15316 has been updated by k0kubun (Takashi Kokubun). I see. > If you can't solve it, can you wait until after the 11/22 developers meeting? Sure. I hope we'll release the fix on rc1, so I'll try to fix that anyway. I hope auto-fiber will be in 2.6 too :) ---------------------------------------- Bug #15316: rb_postponed_job_register not thread-safe https://bugs.ruby-lang.org/issues/15316#change-74919 * Author: normalperson (Eric Wong) * Status: Open * Priority: Normal * Assignee: k0kubun (Takashi Kokubun) * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Consider following execution timeline for two threads, t1 and t2. (should be 2 columns, I only have fixed-width fonts for display) ``` t1 t2 (mjit-worker) ----------------------------------------------------------------------------- vm->postponed_job_index increment #1 pjob[0]->func = ... pjob[0]->data = ... vm->postponed_job_index increment #2 RUBY_VM_SET_POSTPONED_JOB_INTERRUPT rb_postponed_job_flush sees result of increment #2 from t2 tries to access pjob[1] => CRASH pjob[1]->func = ... pjob[1]->data = ... RUBY_VM_SET_POSTPONED_JOB_INTERRUPT ``` So it looks like we need a THREAD-SAFE (not necessarily async-safe) version of rb_postponed_job_register. Or a one-off API for MJIT... job registration for MJIT. -- https://bugs.ruby-lang.org/