summaryrefslogtreecommitdiff
path: root/test/ruby/test_fiber.rb
AgeCommit message (Collapse)Author
2022-01-19`rb_fiber_terminate` must not return [Bug #18497]Nobuyoshi Nakada
In a forked process from a fiber, the fiber becomes the only fiber, `fiber_switch` does nothing as there is no other fibers, `rb_fiber_terminate` does not terminate the fiber. In that case, reaches the end of `fiber_entry` finaly, which is declared as "COROUTINE" and should never return. Notes: Merged: https://github.com/ruby/ruby/pull/5468
2022-01-19Assuming EXIT_SUCCESS equals 0 is not portableNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5468
2022-01-04Use omit instead of skip: test/ruby/**/*.rbHiroshi SHIBATA
2021-12-13Prepare for removing RubyVM::JIT (#5262)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2021-11-09test/ruby/test_fiber.rb: Extend timeout on SolarisYusuke Endoh
The test usually takes 200 sec. on Solaris, so the timeout of 300 sec. looks too short.
2021-07-01Replace copy coroutine with pthread implementation.Samuel Williams
2021-04-28test/ruby/test_fiber.rb: reduce the count of object creation to cause GCYusuke Endoh
... on Solaris. This is the same as 547887138f19959f649b1c0dbcde5659ae3878ed. http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20210427T160003Z.fail.html.gz ``` [ 7667/20965] TestFiber#test_fork_from_fiber/export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:397:in `transfer': can't alloc machine stack to fiber (1 x 139264 bytes): Not enough space (FiberError) from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:397:in `block (6 levels) in test_fork_from_fiber' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:396:in `times' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:396:in `block (5 levels) in test_fork_from_fiber' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:392:in `fork' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:392:in `block (4 levels) in test_fork_from_fiber' = 0.88 s ... 1) Failure: TestFiber#test_fork_from_fiber [/export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:409]: [ruby-core:41456]. <0> expected but was <1>. ```
2021-03-23test/ruby/test_fiber.rb: relax timeout on SolarisYusuke Endoh
... of test_many_fibers_with_threads because the test seems to take about 180 sec. on Solaris. This change extends the limit to 300 sec on Solaris. BTW, 180 sec. is too long for other normal environments, so this reverts Related to 6ab7d439f8d43234004e1760aa88a98c29129006 for them.
2021-01-13Rename RubyVM::MJIT to RubyVM::JITTakashi Kokubun
because the name "MJIT" is an internal code name, it's inconsistent with --jit while they are related to each other, and I want to discourage future JIT implementation-specific (e.g. MJIT-specific) APIs by this rename. [Feature #17490]
2021-01-09Get rid of defining methods for tests in core classesNobuyoshi Nakada
Not to interfere in other tests. Notes: Merged: https://github.com/ruby/ruby/pull/4043
2020-12-12Let Fiber#raise work with transferring fibersnicholas a. evans
This automatically choosess whether to use transfer on a transferring fiber or resume on a yielding fiber. If the fiber is resuming, it raises a FiberError. Notes: Merged: https://github.com/ruby/ruby/pull/3795
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-10-13test/ruby/test_fiber.rb: Suppress "assigned but unused variable" warningsYusuke Endoh
2020-10-12relax Fiber#transfer's restrictionKoichi Sasada
Using Fiber#transfer with Fiber#resume for a same Fiber is limited (once Fiber#transfer is called for a fiber, the fiber can not be resumed more). This restriction was introduced to protect the resume/yield chain, but we realized that it is too much to protect the chain. Instead of the current restriction, we introduce some other protections. (1) can not transfer to the resuming fiber. (2) can not transfer to the yielding fiber. (3) can not resume transferred fiber. (4) can not yield from not-resumed fiber. [Bug #17221] Also at the end of a transferred fiber, it had continued on root fiber. However, if the root fiber resumed a fiber (and that fiber can resumed another fiber), this behavior also breaks the resume/yield chain. So at the end of a transferred fiber, switch to the edge of resume chain from root fiber. For example, root fiber resumed f1 and f1 resumed f2, transferred to f3 and f3 terminated, then continue from the fiber f2 (it was continued from root fiber without this patch). Notes: Merged: https://github.com/ruby/ruby/pull/3636
2020-05-14Thread scheduler for light weight concurrency.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3032 Merged-By: ioquatix <samuel@codeotaku.com>
2020-04-27test/ruby/test_fiber.rb (test_stack_size): re-enabled on s390xYusuke Endoh
Revert 9948addda67f4b7a6e3575f1eba9025f998811d2. It is now discussed in https://bugs.ruby-lang.org/issues/16814, and an assert is added with a217d3cedce3f5aa5c27a1ce6c72b65ec37da057. It would be good to give it a try.
2020-04-22test/ruby/test_fiber.rb: Skip the problematic test_stack_size on riscvYusuke Endoh
Since it is impossible to detect stack overflow of C functions robustly, the test is a bit unreasonable. https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian-riscv64/ruby-master/log/20200421T120018Z.fail.html.gz
2020-04-18Skip a too-unstable test on s390x-linuxTakashi Kokubun
In the last 26-ish hours, it has failed 5 times: https://travis-ci.org/github/ruby/ruby/jobs/676497718 https://travis-ci.org/github/ruby/ruby/jobs/676480295 https://travis-ci.org/github/ruby/ruby/jobs/676103216 https://travis-ci.org/github/ruby/ruby/jobs/676057967 https://travis-ci.org/github/ruby/ruby/jobs/676055113 and I don't think anybody has been working on it right now. To make CI result report of s390x-linux useful, let's skip it until the test is improved to be more stable.
2020-03-22test/ruby/test_fiber.rb (test_many_fibers_with_threads): relax timeoutYusuke Endoh
This test takes 40..50 seconds under Solaris 11, so the timeout (60 seconds) was too strict. This change increases it to 180 seconds. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20200322T100007Z.fail.html.gz ``` 1) Error: TestFiber#test_many_fibers_with_threads: Timeout::Error: execution of assert_normal_exit expired timeout (60 sec) ```
2019-11-13Suspend many fibers test on JIT for nowTakashi Kokubun
https://github.com/ruby/ruby/runs/301411717 No C backtrace information and this is hard to fix immediately. As CI doesn't provide helpful information, this should be debugged locally or at least have more logs there.
2019-10-24Revert "Fix Fiber#transfer"Koichi Sasada
This reverts commit fa8ac91e957a076f6df1adaecad7896817138009. Previous behavior is intentional.
2019-10-21Fix Fiber#transferJeremy Evans
Fiber#transfer previously made it impossible to resume the fiber if it was transferred to (no resuming the target of Fiber#transfer). However, the documentation specifies that you cannot resume a fiber that has transferred to another fiber (no resuming the source of Fiber#transfer), unless control is transferred back. Fix the code by setting the transferred flag on the current/source fiber, and unsetting the transferred flag on the target fiber. Fixes [Bug #9664] Fixes [Bug #12555] Notes: Merged: https://github.com/ruby/ruby/pull/2588 Merged-By: jeremyevans <code@jeremyevans.net>
2019-09-06Try shrinking tested VM stack maxTakashi Kokubun
2019-09-03test/ruby/test_fiber.rb: reduce the count of object creation to cause GCYusuke Endoh
The test consistently fails on OpenBSD. https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20190903T010009Z.fail.html.gz ``` 1) Failure: TestFiber#test_fork_from_fiber [/home/chkbuild/chkbuild/tmp/build/20190903T010009Z/ruby/test/ruby/test_fiber.rb:327]: [ruby-core:41456]. <0> expected but was <1>. ```
2019-08-09restore timeoutKoichi Sasada
2019-08-09extend timeout to debug.Koichi Sasada
2019-08-05Check if signaledNobuyoshi Nakada
2018-12-28Don't allow rb_fiber_resume to raise exception on unborn fiber.samuel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28Implement Fiber#raise. Fixes #10344.samuel
This allows raising exceptions in another fiber, similarly to Thread#raise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-01Avoid GCing dead stack after switching away from a fibersamuel
Fixes <https://bugs.ruby-lang.org/issues/14561> and discussed <https://bugs.ruby-lang.org/issues/15362>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-12fiber: fix crash on GC after forkingnormal
Remove the remainder of ROOT_FIBER_CONTEXT use and unnecessary differences between the root and non-root fiber. This makes it easier to follow new root fiber at fork time. Multiple sources of truth often leads to bugs, as in this case. We can determinte root fiber by checking a fiber against the root_fiber of its owner thread. The new `fiber_is_root_p' function supports that. Now, we can care only about free-ing/recycling/munmap-ing stacks as appropriate. [Bug #15050] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-29cont.c: set th->root_fiber to current fiber at forknormal
Otherwise, th->root_fiber can point to an invalid Fiber, because Fibers do not live across fork. So consider whatever Fiber is running the root fiber. [ruby-core:88723] [Bug #15041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03test_fiber.rb: fix test_create_fiber_in_new_threadnobu
* test/ruby/test_fiber.rb (test_create_fiber_in_new_thread): prefix to run, and get the result value not only waiting. [Bug #14642] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03Fix typonobu
[Bug #14642] [Fix GH-1855] From: MSP-Greg <MSP-Greg@users.noreply.github.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03Fix Fiber with Thread issue on Windows [Bug #14642]ko1
* cont.c (rb_threadptr_root_fiber_setup): divide into two functions: * rb_threadptr_root_fiber_setup_by_parent(): called by the parent thread. * rb_threadptr_root_fiber_setup_by_child(): called by the created thread. `rb_threadptr_root_fiber_setup()` is called by the parent thread and set fib->fib_handle by ConvertThreadToFiber() on the parent thread on Windows enveironment. This means that root_fib->fib_handle of child thread is initialized with parent thread's Fiber handle. Furthermore, second call of `ConvertThreadToFiber()` for the same thread fails. This patch solves this weird situateion. However, maybe we can make more clean code. * thread.c (thread_start_func_2): call `rb_threadptr_root_fiber_setup_by_child()` at thread initialize routine. * vm.c (th_init): call `rb_threadptr_root_fiber_setup_by_parent()`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Fix test-all tests to avoid creating report_on_exception warningseregon
* The warnings are shown by Thread.report_on_exception defaulting to true. [Feature #14143] [ruby-core:83979] * Improves tests by narrowing down the scope where an exception is expected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26make root fiber at switching.ko1
* cont.c (fiber_switch): make sure the root fiber object is available before the first switching. * test/ruby/test_fiber.rb: remove "skip". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26skip test_fiber_transfer_segv because it cause error with previous commitko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22Fixed misspelling words.hsbt
These are detected by https://github.com/client9/misspell git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-08fiber: fix machine stack marking when FIBER_USE_NATIVE is 0normal
* cont.c (cont_mark): mark Fiber machine stack correctly when FIBER_USE_NATIVE is 0 * test/ruby/test_fiber.rb (test_mark_fiber): new test [Bug #13875] [ruby-core:82681] This bug appears to be introduced with r59557. ("refactoring Fiber status") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-02cont.c: fix root fiber to_snobu
* cont.c (fiber_to_s): fix Fiber#to_s on root fibers which have no procs. [ruby-core:82629] [Bug #13859] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10Fiber#to_s (#inspect) return richer information.ko1
* cont.c (fiber_to_s): return with block and status information. * proc.c (proc_to_s_): removed and introduce rb_block_to_s() function to return block information string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14Fiber also has same issue. [Bug #13313]ko1
* thread.c (rb_vm_proc_local_ep): added. * cont.c (rb_fiber_start): use rb_vm_proc_local_ep(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-26increase timeout for Solaris 10 SPARCnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-29test/ruby: suppress warningsnobu
* test/ruby/test_array.rb: (need_continuation): suppress warnings to require continuation. * test/ruby/test_continuation.rb: ditto. * test/ruby/test_enum.rb: ditto. * test/ruby/test_fiber.rb: ditto. * test/ruby/test_hash.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15vm_eval.c: UncaughtThrowErrornobu
* vm_eval.c (rb_throw_obj): throw UncaughtThrowError instead of ArgumentError. [Feature #10480] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-04* test/ruby: get rid of warnings.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14test_fiber.rb: remove corenobu
* test/ruby/test_fiber.rb (TestFiber#invoke_rec): remove core dump files by stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e