ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: takashikkbn@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:89892] [Ruby trunk Bug#15316] rb_postponed_job_register not thread-safe
Date: Tue, 20 Nov 2018 01:12:48 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-74968.20181120011247.3f319eb29b980acd@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15316.20181118044928@ruby-lang.org

Issue #15316 has been updated by k0kubun (Takashi Kokubun).


> If you can't solve it, can you wait until after the 11/22 developers meeting?

As tracked in [Bug #15320], I succeeded to fix it in r 65817. So, please never mind about that.
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/1468912
http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1468910

I'll take a look at postponed_job race then.

----------------------------------------
Bug #15316: rb_postponed_job_register not thread-safe
https://bugs.ruby-lang.org/issues/15316#change-74968

* 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/

  parent reply	other threads:[~2018-11-20  1:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15316.20181118044928@ruby-lang.org>
2018-11-18  4:49 ` [ruby-core:89848] [Ruby trunk Bug#15316] rb_postponed_job_register not thread-safe normalperson
2018-11-18  6:49   ` [ruby-core:89851] " Eric Wong
2018-11-18  8:09 ` [ruby-core:89852] " takashikkbn
2018-11-18  8:19   ` [ruby-core:89853] " Eric Wong
2018-11-18  8:40 ` [ruby-core:89854] " takashikkbn
2018-11-19  0:07 ` [ruby-core:89858] " takashikkbn
2018-11-19  0:22   ` [ruby-core:89859] " Eric Wong
2018-11-19  0:52 ` [ruby-core:89860] " takashikkbn
2018-11-20  1:12 ` takashikkbn [this message]
2018-11-30  5:19 ` [ruby-core:90186] " takashikkbn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-74968.20181120011247.3f319eb29b980acd@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).