summaryrefslogtreecommitdiff
path: root/bootstraptest
AgeCommit message (Collapse)Author
2020-12-19add "copy: true" option for Ractor.make_shareableKoichi Sasada
Ractor.make_shareable(obj) tries to make obj a shareable object by changing the attribute of obj and traversable objects from obj (mainly freeze them). "copy: true" option is more conservative approach by make deep copied object and make it sharable. It doesn't affect any existing objects.
2020-12-16strip trailing spaces [ci skip]Nobuyoshi Nakada
2020-12-16Ractor#receive_if to receive only matched messagesKoichi Sasada
Instead of Ractor.receive, Ractor.receive_if can provide a pattern by a block and you can choose the receiving message. [Feature #17378] Notes: Merged: https://github.com/ruby/ruby/pull/3862
2020-12-13Debug the command used for gdb dumpTakashi Kokubun
It's not working http://ci.rvm.jp/results/trunk-mjit@phosphorus-docker/3288206. I'm debugging why.
2020-12-13@ruby is the target Ruby in bootstraptestTakashi Kokubun
2020-12-12Dump a backtrace with gdbTakashi Kokubun
Because Ruby often fails to dump a C backtrace.
2020-12-12trap on non-main ractorKoichi Sasada
trap can accept blopck/Proc and it can violate Rator isolation, so the Proc should be isolatable when trap is used on non-main ractor. Notes: Merged: https://github.com/ruby/ruby/pull/3888
2020-12-12fix ivar with shareable objects issueKoichi Sasada
Instance variables of sharable objects are accessible only from main ractor, so we need to check it correctly. Notes: Merged: https://github.com/ruby/ruby/pull/3887
2020-12-10Save a core file from bootstraptestTakashi Kokubun
2020-12-10ObjectSpace._id2ref should not support unshareableKoichi Sasada
ObjectSpace._id2ref(id) can return any objects even if they are unshareable, so this patch raises RangeError if it runs on multi-ractor mode and the found object is unshareable. Notes: Merged: https://github.com/ruby/ruby/pull/3878
2020-12-08Add test that `Ractor.make_shareable` calls user defined `#freeze`Marc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3694
2020-12-07Removed deprecated Time#succNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3841
2020-12-07Ractor.select requires an argument or yield_valueMarc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3848
2020-12-07fix Thread's interrupt and Ractor#take issueKoichi Sasada
Thread's interrupt set Ractor's wakeup_status as interrupted, but the status remains next Ractor communication API. This patch makes to ignore the previous interrupt state. [Bug #17366] Also this patch solves the Thread#kill and Ractor#take issues.
2020-12-04Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&Benoit Daloze
* Otherwise those tests, etc cannot run on alternative Ruby implementations.
2020-12-01should not use rb_str_modify(), tooKoichi Sasada
Same as 8247b8edde, should not use rb_str_modify() here. https://bugs.ruby-lang.org/issues/17343#change-88858 Notes: Merged: https://github.com/ruby/ruby/pull/3833
2020-12-01should not use rb_ary_modify()Koichi Sasada
ractor_copy() used rb_ary_modify() to make sure this array is not sharing anything, but it also checks frozen flag. So frozen arrays raises an error. To solve this issue, this patch introduces new function rb_ary_cancel_sharing() which makes sure the array does not share another array and it doesn't check frozen flag. [Bug #17343] A test is quoted from https://github.com/ruby/ruby/pull/3817 Notes: Merged: https://github.com/ruby/ruby/pull/3831
2020-11-30Fix `Ractor.make_shareable` for recursive structures with unfreezable componentsMarc-Andre Lafortune
Followup to #3823 Notes: Merged: https://github.com/ruby/ruby/pull/3827
2020-11-30Fixed Ractor.shareable? on cross-recursive objects [Bug #17344]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3823 Merged-By: nobu <nobu@ruby-lang.org>
2020-11-24Skip test_ractor.rb:137 for --jit-min-calls=5Takashi Kokubun
It's failing like http://ci.rvm.jp/results/trunk-mjit-wait@phosphorus-docker/3270373 but I have no bandwidth to fix it for now. We're still checking --jit-wait (without --jit-min-calls=5) on GitHub Actions.
2020-11-24Report a more detailed situation of test_ractor.rb:137Takashi Kokubun
This test has been very unstable. I'd like to instantly know whether it's always failing or random when I look at a CI failure output.
2020-11-11remove Ractor#closeKoichi Sasada
close_incoming by antoher ractor means there is no other messages will be sent to the ractor, so Ractor.receive will block forever, and it should raise and stop. close_outgoing by antoher ractor means, ... I don't have good idea to use it. It can be a private method. Ractor#close calls both, but it does not make sense to call different purpose methods, so I remove it. Notes: Merged: https://github.com/ruby/ruby/pull/3759
2020-11-11ignore yield_atexit if outgoing port is closedKoichi Sasada
If outgoing_port is closed, Ractor.yield never successes. [Bug #17310] Notes: Merged: https://github.com/ruby/ruby/pull/3755
2020-11-11Threads in a ractor will be killed with the ractorKoichi Sasada
If a terminating ractor has child threads, then kill all child threads. Notes: Merged: https://github.com/ruby/ruby/pull/3754
2020-11-02Copy for Ractor.send() without marshal.Koichi Sasada
Now copying objects do not need marshal protocol. Notes: Merged: https://github.com/ruby/ruby/pull/3728
2020-10-30add a test of define_method with shareable Proc.Koichi Sasada
a method defined by define_method with normal Proc can not cross ractors because the normal Proc is not shareable. However, shareable Proc can be crossed between ractors, so the method with shareable Proc should be called correctly.
2020-10-30Ractor.make_shareable(a_proc)Koichi Sasada
Ractor.make_shareable() supports Proc object if (1) a Proc only read outer local variables (no assignments) (2) read outer local variables are shareable. Read local variables are stored in a snapshot, so after making shareable Proc, any assignments are not affeect like that: ```ruby a = 1 pr = Ractor.make_shareable(Proc.new{p a}) pr.call #=> 1 a = 2 pr.call #=> 1 # `a = 2` doesn't affect ``` [Feature #17284] Notes: Merged: https://github.com/ruby/ruby/pull/3722
2020-10-25Use 'shareable' with an 'e' [ci skip]Marc-Andre Lafortune
2020-10-25Tweak a few Ractor tests that were missing comments [ci skip]Marc-Andre Lafortune
2020-10-25Remove trailing whitespace [ci skip]Marc-Andre Lafortune
2020-10-22allow to access ivars of frozen shareable objectsKoichi Sasada
Accessing a shareable object is prohibitted because it can cause race condition, but if the shareable object is frozen, there is no problem to access ivars.
2020-10-21Ractor.make_shareable(obj)Koichi Sasada
Introduce new method Ractor.make_shareable(obj) which tries to make obj shareable object. Protocol is here. (1) If obj is shareable, it is shareable. (2) If obj is not a shareable object and if obj can be shareable object if it is frozen, then freeze obj. If obj has reachable objects (rs), do rs.each{|o| Ractor.make_shareable(o)} recursively (recursion is not Ruby-level, but C-level). (3) Otherwise, raise Ractor::Error. Now T_DATA is not a shareable object even if the object is frozen. If the method finished without error, given obj is marked as a sharable object. To allow makng a shareable frozen T_DATA object, then set `RUBY_TYPED_FROZEN_SHAREABLE` as type->flags. On default, this flag is not set. It means user defined T_DATA objects are not allowed to become shareable objects when it is frozen. You can make any object shareable by setting FL_SHAREABLE flag, so if you know that the T_DATA object is shareable (== thread-safe), set this flag, at creation time for example. `Ractor` object is one example, which is not a frozen, but a shareable object. Notes: Merged: https://github.com/ruby/ruby/pull/3678
2020-10-20fix conditionKoichi Sasada
2020-10-20skip `echo foo` on SolarisKoichi Sasada
On Solaris, it seems to access ENV in ``, so skip it now. ``` stderr output is not empty Exception `NameError' at bootstraptest.tmp.rb:7 - can not access non-sharable objects in constant Object::ENV by non-main Ractor. #<Thread:0x0044cdf0 run> terminated with exception (report_on_exception is true): bootstraptest.tmp.rb:7:in ``': can not access non-sharable objects in constant Object::ENV by non-main Ractor. (NameError) Exception `Ractor::RemoteError' at <internal:ractor>:130 - thrown by remote Ractor. <internal:ractor>:130:in `take': thrown by remote Ractor. (Ractor::RemoteError) from bootstraptest.tmp.rb:55:in `<main>' bootstraptest.tmp.rb:7:in ``': can not access non-sharable objects in constant Object::ENV by non-main Ractor. (NameError) from bootstraptest.tmp.rb:7:in `ractor_local_globals' from bootstraptest.tmp.rb:54:in `block in <main>' ```
2020-10-20ObjectSpace.each_object with RactorsKoichi Sasada
Unshareable objects should not be touched from multiple ractors so ObjectSpace.each_object should be restricted. On multi-ractor mode, ObjectSpace.each_object only iterates shareable objects. [Feature #17270] Notes: Merged: https://github.com/ruby/ruby/pull/3672
2020-10-20Some global variables can be accessed from ractorsKoichi Sasada
Some global variables should be used from non-main Ractors. [Bug #17268] ```ruby # ractor-local (derived from created ractor): debug '$DEBUG' => $DEBUG, '$-d' => $-d, # ractor-local (derived from created ractor): verbose '$VERBOSE' => $VERBOSE, '$-w' => $-w, '$-W' => $-W, '$-v' => $-v, # process-local (readonly): other commandline parameters '$-p' => $-p, '$-l' => $-l, '$-a' => $-a, # process-local (readonly): getpid '$$' => $$, # thread local: process result '$?' => $?, # scope local: match '$~' => $~.inspect, '$&' => $&, '$`' => $`, '$\'' => $', '$+' => $+, '$1' => $1, # scope local: last line '$_' => $_, # scope local: last backtrace '$@' => $@, '$!' => $!, # ractor local: stdin, out, err '$stdin' => $stdin.inspect, '$stdout' => $stdout.inspect, '$stderr' => $stderr.inspect, ``` Notes: Merged: https://github.com/ruby/ruby/pull/3670
2020-10-14sync generic_ivtblKoichi Sasada
generic_ivtbl is a process global table to maintain instance variables for non T_OBJECT/T_CLASS/... objects. So we need to protect them for multi-Ractor exection. Hint: we can make them Ractor local for unshareable objects, but now it is premature optimization. Notes: Merged: https://github.com/ruby/ruby/pull/3655
2020-10-14sync enc_table and rb_encoding_listKoichi Sasada
enc_table which manages Encoding information. rb_encoding_list also manages Encoding objects. Both are accessed/modified by ractors simultaneously so that they should be synchronized. For enc_table, this patch introduced GLOBAL_ENC_TABLE_ENTER/LEAVE/EVAL to access this table with VM lock. To make shortcut, three new global variables global_enc_ascii, global_enc_utf_8, global_enc_us_ascii are also introduced. For rb_encoding_list, we split it to rb_default_encoding_list (256 entries) and rb_additional_encoding_list. rb_default_encoding_list is fixed sized Array so we don't need to synchronized (and most of apps only needs it). To manage 257 or more encoding objects, they are stored into rb_additional_encoding_list. To access rb_additional_encoding_list., VM lock is needed. Notes: Merged: https://github.com/ruby/ruby/pull/3654
2020-10-10Add Ractor#receive and Ractor.receive and use it in all placesBenoit Daloze
* Keep Ractor#recv/Ractor.recv as an alias for now. Notes: Merged: https://github.com/ruby/ruby/pull/3626
2020-09-27fix typo [ci skip]Koichi Sasada
2020-09-25freeze all Range objects.v3_0_0_preview1Koichi Sasada
Matz want to try to freeze all Range objects. [Feature #15504] Notes: Merged: https://github.com/ruby/ruby/pull/3583
2020-09-25prohibi method call by defined_method in other racotrsKoichi Sasada
We can not call a non-isolated Proc in multiple ractors. Notes: Merged: https://github.com/ruby/ruby/pull/3584
2020-09-25Range is based on Struct.Koichi Sasada
Range can be shareable because it is implemented by Struct. Notes: Merged: https://github.com/ruby/ruby/pull/3580
2020-09-25Frozen Struct can be shareable.Koichi Sasada
A frozen Struct object which refers to shareable objects should be shareable. Notes: Merged: https://github.com/ruby/ruby/pull/3580
2020-09-25refactoring a test code.Koichi Sasada
make a test more clear.
2020-09-25Ractor.yield should raise if out-port is closedKoichi Sasada
Ractor.yield should raise Ractor::ClosedError if current Ractor's outgoing-port is closed. Notes: Merged: https://github.com/ruby/ruby/pull/3578
2020-09-25frozen T_OBJECT can be shareable.Koichi Sasada
If an T_OBJECT object is frozen and all ivars are shareable, the object should be shareable. Notes: Merged: https://github.com/ruby/ruby/pull/3575
2020-09-25Ractor#close_outgoping cancel Ractor.yieldKoichi Sasada
Ractor#close_outgoing should cancel waiting Ractor.yield. However, yield a value by the Ractor's block should not cancel (to recognize terminating Ractor, introduce rb_ractor_t::yield_atexit flag). Notes: Merged: https://github.com/ruby/ruby/pull/3572
2020-09-24Remove test for putiseq insnMichael Lindley
putiseq was removed from instruction set in 2b5bb8a0 Notes: Merged: https://github.com/ruby/ruby/pull/3491
2020-09-20Fulfill missing tests and stabilize testsQuang-Minh Nguyen
Notes: Merged: https://github.com/ruby/ruby/pull/3555