summaryrefslogtreecommitdiff
path: root/bootstraptest/test_ractor.rb
AgeCommit message (Collapse)Author
2024-05-05Fix interrupts during Ractor.selectLuke Gruber
Fixes [Bug #20168]
2024-04-26Skip a flaky Ractor test for YJITTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/8852277192/job/24310631888 https://github.com/ruby/ruby/actions/runs/8851325573/job/24307638329 This seems like an existing, separate issue from what we're currently investigating. The `iseq->body->jit_entry` setup is not Ractor-safe? Let me suppress this for now and revisit this after resolving the ongoing issue.
2024-03-19Implement chilled stringsÉtienne Barrié
[Feature #20205] As a path toward enabling frozen string literals by default in the future, this commit introduce "chilled strings". From a user perspective chilled strings pretend to be frozen, but on the first attempt to mutate them, they lose their frozen status and emit a warning rather than to raise a `FrozenError`. Implementation wise, `rb_compile_option_struct.frozen_string_literal` is no longer a boolean but a tri-state of `enabled/disabled/unset`. When code is compiled with frozen string literals neither explictly enabled or disabled, string literals are compiled with a new `putchilledstring` instruction. This instruction is identical to `putstring` except it marks the String with the `STR_CHILLED (FL_USER3)` and `FL_FREEZE` flags. Chilled strings have the `FL_FREEZE` flag as to minimize the need to check for chilled strings across the codebase, and to improve compatibility with C extensions. Notes: - `String#freeze`: clears the chilled flag. - `String#-@`: acts as if the string was mutable. - `String#+@`: acts as if the string was mutable. - `String#clone`: copies the chilled flag. Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2024-03-15Refactor frozen_string_literal check during compilationJean Boussier
In preparation for https://bugs.ruby-lang.org/issues/20205. The `frozen_string_literal` compilation option will no longer be a boolean but a tri-state: `on/off/default`.
2024-03-14Ensure test suite is compatible with --frozen-string-literalJean Boussier
As preparation for https://bugs.ruby-lang.org/issues/20205 making sure the test suite is compatible with frozen string literals is making things easier.
2024-01-22Skip a flaky Ractor test for YJITTakashi Kokubun
`[BUG] pthread_mutex_lock: Invalid argument (EINVAL)` doesn't seem like a fault of YJIT? https://github.com/ruby/ruby/actions/runs/7614455181/job/20736754975 https://github.com/ruby/ruby/actions/runs/7615316673/job/20739572487
2024-01-02Set Ractor moved object's shape to original object's shapeLuke Gruber
Fixes [Bug #19409]
2023-12-20moved object should not have a shape IDKoichi Sasada
fix [Bug #19917]
2023-12-16remove `Ractor::Selector` from Ruby levelKoichi Sasada
`Ractor::Selector` is not approved by Matz so remove it from Ruby-level. The implementation is used by `Ractor.select` so most of implementation was remaind and calling `rb_init_ractor_selector()`, `Ractor::Selector` will be defined. I will provide `ractor-selector` gem to try it.
2023-07-17Fix a typo [ci skip]Nobuyoshi Nakada
2023-03-15Fix indirect counter incrementNobuyoshi Nakada
`*pcnt++` just dereferences `pcnt` then increments the local variable, but has no side effect. Notes: Merged: https://github.com/ruby/ruby/pull/7496
2023-03-10RJIT: Skip a flaky test_thread test for nowTakashi Kokubun
and unskip a ractor test that was actually running
2023-03-06s/mjit/rjit/Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7462
2023-03-05Add more GC guardsTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7448
2023-03-06add a test for RactorKoichi Sasada
Ractor should take care method cache invalidation. Added test will miss method cache on each method call. Notes: Merged: https://github.com/ruby/ruby/pull/7445
2023-03-03Another attempt to skip test_ractor on ci.rvm.jpTakashi Kokubun
This reverts commit 8d31a60f47fb053bcfe0c744a89bd666dae48539.
2023-03-03Fix a YJIT enablement checkTakashi Kokubun
This should be enough for `make test` and `make btest-ruby` while it doesn't work for `make btest`.
2023-03-02Re-skip an unstable Ractor testTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/4316423442/jobs/7532190115 http://ci.rvm.jp/results/trunk-yjit@ruby-sp2-docker/4466770
2023-03-02Revert "Revert "Re-enable test_ractor for YJIT""Takashi Kokubun
This reverts commit 9792d9e40f790e6deb18ead56a8befc9d5c4bc51. Ractor implementation has been rewritten. Let's see if it works now.
2023-03-03`Ractor::Selector#empty?`Koichi Sasada
It returns the waiting set is empty or not. Also add Ractor::Selector's tests. Notes: Merged: https://github.com/ruby/ruby/pull/7417
2023-03-02Enable flaky ractor testKoichi Sasada
I hope a4421bd73c286253311c2cdf8c78ed258f8cff44 will solve the issue... Notes: Merged: https://github.com/ruby/ruby/pull/7416
2023-03-02Rewrite Ractor synchronization mechanismKoichi Sasada
This patch rewrites Ractor synchronization mechanism, send/receive and take/yield. * API * Ractor::Selector is introduced for lightweight waiting for many ractors. * Data structure * remove `struct rb_ractor_waiting_list` and use `struct rb_ractor_queue takers_queue` to manage takers. * remove `rb_ractor_t::yield_atexit` and use `rb_ractor_t::sync::will_basket::type` to check the will. * add `rb_ractor_basket::p.take` to represent a taking ractor. * Synchronization protocol * For the Ractor local GC, `take` can not make a copy object directly so ask to generate the copy from the yielding ractor. * The following steps shows what `r1.take` does on `r0`. * step1: (r0) register `r0` into `r1`'s takers. * step2: (r0) check `r1`'s status and wakeup r0 if `r1` is waiting for yielding a value. * step3: (r0) sleep until `r1` wakes up `r0`. * The following steps shows what `Ractor.yield(v)` on `r1`. * step1: (r1) check first takers of `r1` and if there is (`r0`), make a copy object of `v` and pass it to `r0` and wakes up `r0`. * step2: (r1) if there is no taker ractors, sleep until another ractor try to take. Notes: Merged: https://github.com/ruby/ruby/pull/7371
2023-01-11Remove Encoding#replicateBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/7079
2023-01-09Revert "Re-enable test_ractor for YJIT"Takashi Kokubun
This reverts commit 650a20a3e1205f47224a987676cdbad7d826d597. Now that 3.2.0 is released, let's disable flaky tests. Koichi said he'll rework Ractor implementation for this, and it has not been done yet.
2022-12-21Skip a flaky Ractor test for mswinTakashi Kokubun
2022-12-19Re-enable test_ractor for YJITTakashi Kokubun
This would be still flaky, but we want to make sure there's no YJIT-specific issue when Ruby 3.2 is released. We might skip it again after the release.
2022-12-16fixed encoding tableKoichi Sasada
This reduces global lock acquiring for reading. https://bugs.ruby-lang.org/issues/18949 Notes: Merged: https://github.com/ruby/ruby/pull/6935
2022-12-13Skip yet another flaky Ractor testTakashi Kokubun
2022-12-02Skip another flaky Ractor test for YJITTakashi Kokubun
2022-12-02Skip a couple of Ractor testsTakashi Kokubun
Koichi plans to rework Ractor implementation to address these failures. He agreed to skip flaky Ractor tests for now.
2022-11-14Rename --mjit-min-calls to --mjit-call-threshold (#6731)Takashi Kokubun
for consistency with YJIT Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2022-10-26[Bug #19081] Show the caller location in warning for RactorNobuyoshi Nakada
The internal location in ractor.rb is not usefull at all. ``` $ ruby -e 'Ractor.new {}' <internal:ractor>:267: warning: Ractor is experimental, ... ``` Notes: Merged: https://github.com/ruby/ruby/pull/6629 Merged-By: nobu <nobu@ruby-lang.org>
2022-10-14Add test for ractor race condition on ivar setsJemma Issroff
Notes: Merged: https://github.com/ruby/ruby/pull/6490
2021-12-24@@cv is not accessible from non-main ractorsKoichi Sasada
Class variables (@@cv) is not accessible from non-main ractors. But without this patch cached @@cv can be read. fix [Bug #18128] Notes: Merged: https://github.com/ruby/ruby/pull/5335
2021-12-15prohibit load by `autoload` on non-main RactorKoichi Sasada
fix [Bug #18120] Notes: Merged: https://github.com/ruby/ruby/pull/5267
2021-12-09`Ractor.make_shareable` checks proc's seflKoichi Sasada
`Ractor.make_shareable(proc_obj)` raises an `IsolationError` if the self of `proc_obj` is not a shareable object. [Bug #18243] Notes: Merged: https://github.com/ruby/ruby/pull/5232
2021-11-07rb_id_serial_to_id: return unregistered ID as an internal IDNobuyoshi Nakada
```ruby def foo(*); ->{ super }; end ``` This code makes anonymous parameters which is not registered as an ID. The problem is that when Ractors try to scan `getlocal` instructions, it puts the Symbol corresponding to the parameter in to a hash. Since it is not registered, we end up with a strange exception. This commit wraps the unregistered ID in an internal ID so that we get the same exception for `...` as `*`. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: John Hawthorn <john@hawthorn.email> Notes: Merged: https://github.com/ruby/ruby/pull/5035
2021-10-27the core problem is the Proc is not shareableSatoshi Moris Tagomori
Notes: Merged: https://github.com/ruby/ruby/pull/4771
2021-10-23allow to access ivars of classes/modulesKoichi Sasada
if an ivar of a class/module refer to a shareable object, this ivar can be read from non-main Ractors. Notes: Merged: https://github.com/ruby/ruby/pull/5006
2021-10-06Fix Ractor.make_shareable changing locals for ProcsAlan Wu
env_copy() uses rb_ary_delete_at() with a loop counting up while iterating through the list of read only locals. rb_ary_delete_at() can shift elements in the array to an index lesser than the loop index, causing locals to be missed and set to Qfalse in the returned environment. Iterate through the locals in reverse instead, this way the shifting never happens for locals that are yet to be visited and we process all the locals in the array. [Bug #18023] Notes: Merged: https://github.com/ruby/ruby/pull/4940 Merged-By: XrXr
2021-08-24[Bug #18117] Fix Ractor race condition with GCPeter Zhu
rb_objspace_reachable_objects_from requires that the GC not be active. Since the Ractor barrier is not executed for incremental sweeping, Ractor may call rb_objspace_reachable_objects_from after sweeping has started to share objects. This causes a crash that looks like the following: ``` <internal:ractor>:627: [BUG] rb_objspace_reachable_objects_from() is not supported while during_gc == true ``` Co-authored-by: Vinicius Stock <vinicius.stock@shopify.com> Notes: Merged: https://github.com/ruby/ruby/pull/4755
2021-06-29Prefer qualified names under ThreadNobuyoshi Nakada
2021-06-23Evacuate transient heap when enabling ractorseileencodes
If the GC has been disabled we need to re-enable it so we can evacuate the transient heap. Fixes https://bugs.ruby-lang.org/issues/17985 [Bug #17985] [ruby-core:104260] Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4596
2021-05-25bootstraptest/test_ractor.rb: Skip an assertion on Travis arm64.Jun Aruga
Skip the assertion to test the `Ractor.select` from multiple ractors that rarely fails on Travis arm64. See <https://bugs.ruby-lang.org/issues/17878>. Notes: Merged: https://github.com/ruby/ruby/pull/4518
2021-03-07Make Ractor stdio belonging to the Ractor [Bug #17672]Nobuyoshi Nakada
Defer making ractor stdio until ractor started. Before ractor started, created objects belong to the caller ractor instead of the created ractor. Notes: Merged: https://github.com/ruby/ruby/pull/4241 Merged-By: nobu <nobu@ruby-lang.org>
2021-02-18Ractor.allocate should not be allowedKoichi Sasada
Ractor.allocate and Ractor#dup should not be allowed like Thread. [Bug #17642] Notes: Merged: https://github.com/ruby/ruby/pull/4198
2021-02-10Fixed race in dtoa [Bug #17612]Nobuyoshi Nakada
Fixed the race condition when replacing `freelist` entry with its chained next element. At acquiring an entry, hold the entry once with the special value, then release by replacing it with the next element again after acquired. If another thread is holding the same entry at that time, spinning until the entry gets released. Co-Authored-By: Koichi Sasada <ko1@atdot.net> Notes: Merged: https://github.com/ruby/ruby/pull/4167
2021-02-01Implement NameError::message#clone for RactorNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4142
2021-01-22fix Ractor.yield(obj, move: true)Koichi Sasada
Ractor.yield(obj, move: true) and Ractor.select(..., yield_value: obj, move: true) tried to yield a value with move semantices, but if the trial is faild, the obj should not become a moved object. To keep this rule, `wait_moving` wait status is introduced. New yield/take process: (1) If a ractor tried to yield (move:true), make taking racotr's wait status `wait_moving` and make a moved object by `ractor_move(obj)` and wakeup taking ractor. (2) If a ractor tried to take a message from a ractor waiting fo yielding (move:true), wakeup the ractor and wait for (1). Notes: Merged: https://github.com/ruby/ruby/pull/4105
2021-01-05enable constant cache on ractorsKoichi Sasada
constant cache `IC` is accessed by non-atomic manner and there are thread-safety issues, so Ruby 3.0 disables to use const cache on non-main ractors. This patch enables it by introducing `imemo_constcache` and allocates it by every re-fill of const cache like `imemo_callcache`. [Bug #17510] Now `IC` only has one entry `IC::entry` and it points to `iseq_inline_constant_cache_entry`, managed by T_IMEMO object. `IC` is atomic data structure so `rb_mjit_before_vm_ic_update()` and `rb_mjit_after_vm_ic_update()` is not needed. Notes: Merged: https://github.com/ruby/ruby/pull/4022