aboutsummaryrefslogtreecommitdiffstats
path: root/test/fiber
Commit message (Collapse)AuthorAgeFilesLines
* `rb_fiber_terminate` must not return [Bug #18497]Nobuyoshi Nakada2022-01-191-0/+15
| | | | | | | | 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.
* Use omit instead of skip without the default gems testsHiroshi SHIBATA2022-01-114-13/+13
|
* Improve interface for get/set/copy.Samuel Williams2021-12-211-2/+2
|
* test/fiber/test_io_buffer.rb: fix file descriptor leaksKazuki Yamaguchi2021-12-211-1/+12
| | | | | | | | | I got the warning while running "make test-all": Leaked file descriptor: TestFiberIOBuffer#test_write_nonblock: 9 : #<UNIXSocket:fd 9> Closed file descriptor: TestFiberIOBuffer#test_read_write_blocking: 9 Leaked file descriptor: TestFiberIOBuffer#test_timeout_after: 10 : #<UNIXSocket:fd 10> Closed file descriptor: TestFiberIOBuffer#test_read_nonblock: 10
* Introduce io_result wrapper for passing `[-errno, size]` in VALUE.Samuel Williams2021-12-183-0/+228
|
* Suppress the “experimental" warnings for `IO::Buffer`Nobuyoshi Nakada2021-11-231-0/+8
| | | | | As this warning is emitted just once per processes, needs in each files when parallel testing.
* Mark IO::Buffer as experimental.Samuel Williams2021-11-101-0/+1
|
* Add alternative optional hook for `scheduler_close` to allow public usage of ↵Samuel Williams2021-09-201-3/+15
| | | | close.
* Fix example fiber scheduler reg. writable eventsLars Kanis2021-08-262-1/+46
| | | | | | | | | | There were two issues: 1. When an IO object is waiting for writablility only (as in test_tcp_accept) the selected hash is empty. Therefore selected[fiber] returns nil but needs to default to 0 in order to be or'ed with IO::WRITABLE. 2. When an IO object is waiting for read- or writability (as in test_tcp_connect), but only one of these two events arrive, the Fiber and IO object need to be removed from the other `@readable` or `@writable` list.
* Fix potential hang when joining threads.Samuel Williams2021-08-032-2/+53
| | | | | | | | | | | If the thread termination invokes user code after `th->status` becomes `THREAD_KILLED`, and the user unblock function causes that `th->status` to become something else (e.g. `THREAD_RUNNING`), threads waiting in `thread_join_sleep` will hang forever. We move the unblock function call to before the thread status is updated, and allow threads to join as soon as `th->value` becomes defined. This reverts commit 6505c77501f1924571b2fe620c5c7b31ede0cd22.
* Revert "Fix potential hang when joining threads."Yusuke Endoh2021-07-282-28/+2
| | | | | | | | | | | This reverts commit 13f8521c630a15c87398dee0763e95f59c032a94. http://rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20210727T230009Z.fail.html.gz http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210728T000009Z.fail.html.gz This revert is to confirm whether the commit is the cause. If the failures consistently occur after this revert, I'll reintroduce the commit.
* Fix potential hang when joining threads.Samuel Williams2021-07-272-2/+28
| | | | | | | | | If the thread termination invokes user code after `th->status` becomes `THREAD_KILLED`, and the user unblock function causes that `th->status` to become something else (e.g. `THREAD_RUNNING`), threads waiting in `thread_join_sleep` will hang forever. We move the unblock function call to before the thread status is updated, and allow threads to join as soon as `th->value` becomes defined.
* Prefer qualified names under ThreadNobuyoshi Nakada2021-06-292-13/+15
|
* Suppress exception report in inner threadNobuyoshi Nakada2021-06-151-1/+3
|
* Close leaked file descriptorsNobuyoshi Nakada2021-06-152-0/+5
|
* Fix fiber scheduler address resolve solaris testsBruno Sutic2021-06-141-5/+2
|
* Wake up join list within thread EC context. (#4471)Samuel Williams2021-06-144-2/+66
| | | | | | | | | | | | | | | * Wake up join list within thread EC context. * Consume items from join list so that they are not re-executed. If `rb_fiber_scheduler_unblock` raises an exception, it can result in a segfault if `rb_threadptr_join_list_wakeup` is not within a valid EC. This change moves `rb_threadptr_join_list_wakeup` into the thread's top level EC which initially caused an infinite loop because on exception will retry. We explicitly remove items from the thread's join list to avoid this situation. * Verify the required scheduler interface. * Test several scheduler hooks methods with broken `unblock` implementation.
* Add scheduler hook `Addrinfo.getaddrinfo`. (#4375)Samuel Williams2021-06-142-0/+287
| | | Co-authored-by: Bruno Sutic <code@brunosutic.com>
* Test incorrect behaviour of `rb_io_wait_readable/writable`.Samuel Williams2021-03-301-0/+35
|
* Fix handling of timeout accessing scheduler outside of non-blocking context.Samuel Williams2021-03-302-0/+18
|
* Improve timeout tests.Samuel Williams2021-03-301-1/+20
|
* Update method name and add documentation.Samuel Williams2021-03-302-2/+2
|
* Add hook for `Timeout.timeout`.Samuel Williams2021-03-302-4/+54
|
* Expose scheduler as public interface & bug fixes. (#3945)Samuel Williams2021-02-093-9/+71
| | | | | | | | | * Rename `rb_scheduler` to `rb_fiber_scheduler`. * Use public interface if available. * Use `rb_check_funcall` where possible. * Don't use `unblock` unless the fiber was non-blocking.
* Add verbose nil in testingDelton Ding2020-12-231-0/+1
|
* Enable `Fiber.current` and `Fiber#alive?` call inside ractorDelton Ding2020-12-231-0/+22
|
* Add support for non-blocking `Process.wait`.Samuel Williams2020-12-092-0/+43
|
* Fix TestFiberMutex#test_condition_variable assertionBenoit Daloze2020-11-081-5/+3
| | | | * Now that it works correctly.
* Urgent notification pipe has same lifetime as scheduler.Samuel Williams2020-11-081-11/+10
|
* Defer `kernel_sleep` to `block` to avoid exiting the event loop when ↵Samuel Williams2020-11-081-6/+1
| | | | duration is nil.
* Rename to `Fiber#set_scheduler`.Samuel Williams2020-11-076-22/+38
|
* Refined assertions for better failure messagesNobuyoshi Nakada2020-10-011-4/+4
|
* strip trailing spaces [ci skip]Nobuyoshi Nakada2020-10-011-1/+1
|
* Remove `Thread.scheduler` from public interface.Samuel Williams2020-10-011-7/+6
| | | | | | It's implementation is equivalent to: Thread.current.scheduler unless Thread.current.blocking?
* Raise an exception if the scheduler was already closed.Samuel Williams2020-10-011-0/+2
|
* Don't call `Scheduler#close` if it doesn't exist.Samuel Williams2020-10-011-0/+8
|
* Fix order of operations during `rb_ec_finalize`.Samuel Williams2020-09-301-0/+14
|
* Remove unnecessary executable bit [ci skip]Kazuhiro NISHIYAMA2020-09-281-0/+0
|
* test/fiber/scheduler.rb: Prevent "instance variable @urgent not initialized"Yusuke Endoh2020-09-241-0/+2
|
* strip trailing spaces [ci skip]Nobuyoshi Nakada2020-09-231-1/+1
|
* Simplify the implementation of Scheduler#blockBenoit Daloze2020-09-211-13/+15
| | | | | * This shows block() with a timeout is similar to #kernel_sleep and also does not need to change `@blocking`.
* Make `Thread#join` non-blocking.Samuel Williams2020-09-211-6/+16
|
* When setting current thread scheduler to nil, invoke `#close`.Samuel Williams2020-09-212-0/+40
|
* Remove from waiter in Mutex#lock with ensure when calling rb_scheduler_block()Benoit Daloze2020-09-201-0/+32
| | | | | * Previously this could lead to an invalid waiter entry and then trying to wake up that waiter would result in various issues in rb_mutex_unlock_th().
* Add missing goto found;Benoit Daloze2020-09-171-1/+2
| | | | | * To still remove the lock from the Thread's list of acquired locks. * Also to not wake up other waiters and preserve blocking behavior.
* Fix Mutex#unlock with a scheduler and thread contentionBenoit Daloze2020-09-171-0/+23
| | | | * It would hit "[BUG] unexpected THREAD_STOPPED" before.
* Document the various scheduler hooksBenoit Daloze2020-09-171-0/+3
|
* Call scheduler.block instead of scheduler.kernel_sleep for blocking ↵Benoit Daloze2020-09-172-1/+27
| | | | | | | Queue/SizedQueue operations * scheduler.unblock was already already called before but with no corresponding scheduler.block * add test that Queue#pop makes the scheduler wait until it gets an element.
* Rename scheduler.{mutex_lock,mutex_unlock} to {block,unblock}Benoit Daloze2020-09-171-12/+15
| | | | * Move #kernel_sleep next to #block as it is similar
* Use a similar pattern for waiting and readyBenoit Daloze2020-09-171-4/+3
|