<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_thread.rb, branch v4.0.4</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 08372635f7ec09f7115bd254246ebd637499651c: [Backport #21926]</title>
<updated>2026-03-16T18:57:04+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2026-03-16T18:57:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a601b899a35c796775309dca01a6d5e64be14c44'/>
<id>a601b899a35c796775309dca01a6d5e64be14c44</id>
<content type='text'>
	Fix race condition right after ubf registration

	Fixes [Bug #21926]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix race condition right after ubf registration

	Fixes [Bug #21926]
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unused variable warning</title>
<updated>2025-10-06T20:49:38+00:00</updated>
<author>
<name>Étienne Barrié</name>
<email>etienne.barrie@gmail.com</email>
</author>
<published>2025-10-06T14:37:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=03030bf112db6346b4055adb098bc93b95b6321a'/>
<id>03030bf112db6346b4055adb098bc93b95b6321a</id>
<content type='text'>
    $ make test/ruby/test_thread.rb RUBYOPT=-w &gt;/dev/null
    test/ruby/test_thread.rb:1595: warning: assigned but unused variable - bug21127
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
    $ make test/ruby/test_thread.rb RUBYOPT=-w &gt;/dev/null
    test/ruby/test_thread.rb:1595: warning: assigned but unused variable - bug21127
</pre>
</div>
</content>
</entry>
<entry>
<title>Properly unlock locked mutexes on thread cleanup.</title>
<updated>2025-09-25T22:29:47+00:00</updated>
<author>
<name>Luke Gruber</name>
<email>luke.gruber@shopify.com</email>
</author>
<published>2025-08-18T14:47:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=62430c19c9f1ab49429cebe65f30588472648c95'/>
<id>62430c19c9f1ab49429cebe65f30588472648c95</id>
<content type='text'>
Mutexes were being improperly unlocked on thread cleanup. This bug was
introduced in 050a8954395.

We must keep a reference from the mutex to the thread, because if the fiber
is collected before the mutex is, then we cannot unlink it from the thread in
`mutex_free`. If it's not unlinked from the the thread when it's freed, it
causes bugs in `rb_thread_unlock_all_locking_mutexes`.

We now mark the fiber when a mutex is locked, and the thread is marked
as well. However, a fiber can still be freed in the same GC cycle as the
mutex, so the reference to the thread is still needed.

The reason we need to mark the fiber is that `mutex_owned_p()` has an ABA
issue where if the fiber is collected while it's locked, a new fiber could be
allocated at the same memory address and we could get false positives.

Fixes [Bug #21342]

Co-authored-by: John Hawthorn &lt;john@hawthorn.email&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mutexes were being improperly unlocked on thread cleanup. This bug was
introduced in 050a8954395.

We must keep a reference from the mutex to the thread, because if the fiber
is collected before the mutex is, then we cannot unlink it from the thread in
`mutex_free`. If it's not unlinked from the the thread when it's freed, it
causes bugs in `rb_thread_unlock_all_locking_mutexes`.

We now mark the fiber when a mutex is locked, and the thread is marked
as well. However, a fiber can still be freed in the same GC cycle as the
mutex, so the reference to the thread is still needed.

The reason we need to mark the fiber is that `mutex_owned_p()` has an ABA
issue where if the fiber is collected while it's locked, a new fiber could be
allocated at the same memory address and we could get false positives.

Fixes [Bug #21342]

Co-authored-by: John Hawthorn &lt;john@hawthorn.email&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix a flaky test by making sure that a test thread stops</title>
<updated>2025-04-24T10:06:49+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2025-04-24T08:59:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5113869f5d0c6f6a0349a23f479240210fefe5d0'/>
<id>5113869f5d0c6f6a0349a23f479240210fefe5d0</id>
<content type='text'>
```
    1) Failure:
  TestThread#test_join_argument_conversion [D:/a/ruby/ruby/src/test/ruby/test_thread.rb:249]:
  Expected nil (oid=4) to be the same as #&lt;TestThread::Thread:0x000001e9e13bbc18 D:/a/ruby/ruby/src/test/ruby/test_thread.rb:245 run&gt; (oid=3856).
```
https://github.com/ruby/ruby/actions/runs/14636019219/job/41067199813?pr=13169
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
```
    1) Failure:
  TestThread#test_join_argument_conversion [D:/a/ruby/ruby/src/test/ruby/test_thread.rb:249]:
  Expected nil (oid=4) to be the same as #&lt;TestThread::Thread:0x000001e9e13bbc18 D:/a/ruby/ruby/src/test/ruby/test_thread.rb:245 run&gt; (oid=3856).
```
https://github.com/ruby/ruby/actions/runs/14636019219/job/41067199813?pr=13169
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #21127] Thread deadlock does not display backtraces (#12721)</title>
<updated>2025-02-14T07:31:58+00:00</updated>
<author>
<name>Masataka Pocke Kuwabara</name>
<email>kuwabara@pocke.me</email>
</author>
<published>2025-02-14T07:31:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0cab608d3a7791c229eea2ebe276494f063c8176'/>
<id>0cab608d3a7791c229eea2ebe276494f063c8176</id>
<content type='text'>
Previously, Ruby displayed backtraces for each thread on deadlock. However, it has not been shown since Ruby 3.0.
It should display the backtrace for debugging.

Co-authored-by: Jeremy Evans &lt;code@jeremyevans.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, Ruby displayed backtraces for each thread on deadlock. However, it has not been shown since Ruby 3.0.
It should display the backtrace for debugging.

Co-authored-by: Jeremy Evans &lt;code@jeremyevans.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #21116] Extract RJIT as a third-party gem</title>
<updated>2025-02-13T09:01:03+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-02-13T06:59:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4a67ef09ccd703047552b740431cfe15e32451f4'/>
<id>4a67ef09ccd703047552b740431cfe15e32451f4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove dependency on fiddle from test/ruby</title>
<updated>2024-06-04T10:53:04+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2024-06-04T08:53:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=892849ac986f7e4121e22c7d532d6d6937c0f12c'/>
<id>892849ac986f7e4121e22c7d532d6d6937c0f12c</id>
<content type='text'>
Co-authored-by: "Nobuyoshi Nakada" &lt;nobu@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: "Nobuyoshi Nakada" &lt;nobu@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>M:N thread scheduler for Ractors</title>
<updated>2023-10-12T05:47:01+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2023-04-10T01:53:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=be1bbd5b7d40ad863ab35097765d3754726bbd54'/>
<id>be1bbd5b7d40ad863ab35097765d3754726bbd54</id>
<content type='text'>
This patch introduce M:N thread scheduler for Ractor system.

In general, M:N thread scheduler employs N native threads (OS threads)
to manage M user-level threads (Ruby threads in this case).
On the Ruby interpreter, 1 native thread is provided for 1 Ractor
and all Ruby threads are managed by the native thread.

From Ruby 1.9, the interpreter uses 1:1 thread scheduler which means
1 Ruby thread has 1 native thread. M:N scheduler change this strategy.

Because of compatibility issue (and stableness issue of the implementation)
main Ractor doesn't use M:N scheduler on default. On the other words,
threads on the main Ractor will be managed with 1:1 thread scheduler.

There are additional settings by environment variables:

`RUBY_MN_THREADS=1` enables M:N thread scheduler on the main ractor.
Note that non-main ractors use the M:N scheduler without this
configuration. With this configuration, single ractor applications
run threads on M:1 thread scheduler (green threads, user-level threads).

`RUBY_MAX_CPU=n` specifies maximum number of native threads for
M:N scheduler (default: 8).

This patch will be reverted soon if non-easy issues are found.

[Bug #19842]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch introduce M:N thread scheduler for Ractor system.

In general, M:N thread scheduler employs N native threads (OS threads)
to manage M user-level threads (Ruby threads in this case).
On the Ruby interpreter, 1 native thread is provided for 1 Ractor
and all Ruby threads are managed by the native thread.

From Ruby 1.9, the interpreter uses 1:1 thread scheduler which means
1 Ruby thread has 1 native thread. M:N scheduler change this strategy.

Because of compatibility issue (and stableness issue of the implementation)
main Ractor doesn't use M:N scheduler on default. On the other words,
threads on the main Ractor will be managed with 1:1 thread scheduler.

There are additional settings by environment variables:

`RUBY_MN_THREADS=1` enables M:N thread scheduler on the main ractor.
Note that non-main ractors use the M:N scheduler without this
configuration. With this configuration, single ractor applications
run threads on M:1 thread scheduler (green threads, user-level threads).

`RUBY_MAX_CPU=n` specifies maximum number of native threads for
M:N scheduler (default: 8).

This patch will be reverted soon if non-easy issues are found.

[Bug #19842]
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix Thread#native_thread_id being cached across fork (#8418)</title>
<updated>2023-09-15T01:33:32+00:00</updated>
<author>
<name>KJ Tsanaktsidis</name>
<email>kj@kjtsanaktsidis.id.au</email>
</author>
<published>2023-09-15T01:33:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0117a6d389c5b607eaec1b7f917132efa356f665'/>
<id>0117a6d389c5b607eaec1b7f917132efa356f665</id>
<content type='text'>
The native thread ID can and does change on some operating systems (e.g.
Linux) after forking, so it needs to be re-queried.

[Bug #19873]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The native thread ID can and does change on some operating systems (e.g.
Linux) after forking, so it needs to be re-queried.

[Bug #19873]</pre>
</div>
</content>
</entry>
<entry>
<title>Remove --disable-gems in assert_in_out_err</title>
<updated>2023-08-28T19:05:19+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-08-26T23:31:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=91de37c23ec6b048e45df79cef1cb93a86316929'/>
<id>91de37c23ec6b048e45df79cef1cb93a86316929</id>
<content type='text'>
assert_in_out_err adds --disable=gems so we don't need to add
--disable-gems in the args list.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
assert_in_out_err adds --disable=gems so we don't need to add
--disable-gems in the args list.
</pre>
</div>
</content>
</entry>
</feed>
