<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ruby.git/thread.c, branch ruby_2_4</title>
<subtitle>github.com: ruby/ruby.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/'/>
<entry>
<title>Revert r66968</title>
<updated>2019-02-01T02:17:14+00:00</updated>
<author>
<name>usa</name>
<email>usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2019-02-01T02:17:14+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=1cc19523c25029d66df15086de65b01a7dbe98f7'/>
<id>1cc19523c25029d66df15086de65b01a7dbe98f7</id>
<content type='text'>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@66975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@66975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 64589,64593: [Backport #15041]</title>
<updated>2019-01-31T11:02:52+00:00</updated>
<author>
<name>usa</name>
<email>usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2019-01-31T11:02:52+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=1de793a57f7c3e5596a64530fbf5a58fc5910100'/>
<id>1de793a57f7c3e5596a64530fbf5a58fc5910100</id>
<content type='text'>
	cont.c: set th-&gt;root_fiber to current fiber at fork

	Otherwise, th-&gt;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]

	cont.c (rb_fiber_atfork): th-&gt;root_fiber may not exist

	Otherwise, bootstraptest/test_fork.rb fails with -DVM_CHECK_MODE=2

	[Bug #15041]

	Fixes: r64589 "cont.c: set th-&gt;root_fiber to current fiber at fork"

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@66968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	cont.c: set th-&gt;root_fiber to current fiber at fork

	Otherwise, th-&gt;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]

	cont.c (rb_fiber_atfork): th-&gt;root_fiber may not exist

	Otherwise, bootstraptest/test_fork.rb fails with -DVM_CHECK_MODE=2

	[Bug #15041]

	Fixes: r64589 "cont.c: set th-&gt;root_fiber to current fiber at fork"

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@66968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 64007,64019,64020: [Backport #14929]</title>
<updated>2018-08-27T14:08:56+00:00</updated>
<author>
<name>usa</name>
<email>usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2018-08-27T14:08:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=95abe79e04c3238ea2dde68ea1ab567e354aad21'/>
<id>95abe79e04c3238ea2dde68ea1ab567e354aad21</id>
<content type='text'>
	thread.c (do_select): fix leak on exception

	When do_select is interrupted and raise happens from
	RUBY_VM_CHECK_INTS_BLOCKING, the original FD sets we copied
	do not get freed, leading to a memory leak.  Wrap up all the
	FD sets into a Ruby object to ensure the GC can release an
	allocations made for rb_fdset_t.

	This leak existed since Ruby 2.0.0 (r36430)

	[Bug #14929]

	increase timeout seconds.
	* test/ruby/test_io.rb (test_select_leak): increase timeout seconds
	  to pass this test on a high-load machine.


	60 sec is not enough at all


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@64561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	thread.c (do_select): fix leak on exception

	When do_select is interrupted and raise happens from
	RUBY_VM_CHECK_INTS_BLOCKING, the original FD sets we copied
	do not get freed, leading to a memory leak.  Wrap up all the
	FD sets into a Ruby object to ensure the GC can release an
	allocations made for rb_fdset_t.

	This leak existed since Ruby 2.0.0 (r36430)

	[Bug #14929]

	increase timeout seconds.
	* test/ruby/test_io.rb (test_select_leak): increase timeout seconds
	  to pass this test on a high-load machine.


	60 sec is not enough at all


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@64561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 62673: [Backport #14577]</title>
<updated>2018-03-25T05:54:39+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2018-03-25T05:54:39+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=e59be153682d6240b2dd571c2272fb31f905d84c'/>
<id>e59be153682d6240b2dd571c2272fb31f905d84c</id>
<content type='text'>
	thread.c: deadlock in backtrace

	* thread.c (unblock_function_set): check interrupts just once
	  during raising exceptions, as they are deferred since r16651.
	  [ruby-core:85939] [Bug #14577]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	thread.c: deadlock in backtrace

	* thread.c (unblock_function_set): check interrupts just once
	  during raising exceptions, as they are deferred since r16651.
	  [ruby-core:85939] [Bug #14577]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 59963: [Backport #13163]</title>
<updated>2018-03-10T02:32:56+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2018-03-10T02:32:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=3c35067cfc20c510f26d16466015d2195736801b'/>
<id>3c35067cfc20c510f26d16466015d2195736801b</id>
<content type='text'>
	thread.c: report then abort

	* thread.c (thread_start_func_2): report then abort on exception,
	  if both are set.  [ruby-core:79280] [Bug #13163]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	thread.c: report then abort

	* thread.c (thread_start_func_2): report then abort on exception,
	  if both are set.  [ruby-core:79280] [Bug #13163]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 59462,59474: [Backport #13772]</title>
<updated>2017-08-05T06:35:02+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-08-05T06:35:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=01cfae3beb0b649ca2ae879825349cf0330a3549'/>
<id>01cfae3beb0b649ca2ae879825349cf0330a3549</id>
<content type='text'>
	release VM stack properly.

	* cont.c: r55766 change the handling method of Fiber's VM stack.
	  Resumed Fiber points NULL as VM stack and running Thread has
	  responsibility to manage it (marking and releasing).

	  However, thread_start_func_2()@thread.c and thread_free()@vm.c
	  doesn't free the VM stack if corresponding root Fiber is exist.
	  This causes memory leak. [Bug #13772]

	* cont.c (root_fiber_alloc): fib-&gt;cont.saved_thread.ec.stack should be NULL
	  because running thread has responsibility to manage this stack.

	* vm.c (rb_thread_recycle_stack_release): assert given stack is not NULL
	  (callers should care it).

	fix stack storing for root fibers.

	* cont.c (root_fiber_alloc): this function is called by fiber_current()
	  and fiber_store(). fiber_current() should clear VM stack information
	  in a fiber data because runnning thread knows stack information and has
	  responsibility to manage it. However fiber_store() requires to remain
	  VM stack information in a fiber data because the responsibility to manage
	  VM stack is moved to the Fiber from the Thread (and switch to another
	  fiber).

	* cont.c (root_fiber_alloc): save thread's fiber and root_fiber information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	release VM stack properly.

	* cont.c: r55766 change the handling method of Fiber's VM stack.
	  Resumed Fiber points NULL as VM stack and running Thread has
	  responsibility to manage it (marking and releasing).

	  However, thread_start_func_2()@thread.c and thread_free()@vm.c
	  doesn't free the VM stack if corresponding root Fiber is exist.
	  This causes memory leak. [Bug #13772]

	* cont.c (root_fiber_alloc): fib-&gt;cont.saved_thread.ec.stack should be NULL
	  because running thread has responsibility to manage this stack.

	* vm.c (rb_thread_recycle_stack_release): assert given stack is not NULL
	  (callers should care it).

	fix stack storing for root fibers.

	* cont.c (root_fiber_alloc): this function is called by fiber_current()
	  and fiber_store(). fiber_current() should clear VM stack information
	  in a fiber data because runnning thread knows stack information and has
	  responsibility to manage it. However fiber_store() requires to remain
	  VM stack information in a fiber data because the responsibility to manage
	  VM stack is moved to the Fiber from the Thread (and switch to another
	  fiber).

	* cont.c (root_fiber_alloc): save thread's fiber and root_fiber information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 59030,59031: [Backport #13638]</title>
<updated>2017-07-09T19:36:49+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-07-09T19:36:49+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=11fdbaddf29d9566104439e1cf74b5cb053b741d'/>
<id>11fdbaddf29d9566104439e1cf74b5cb053b741d</id>
<content type='text'>
	thread.c: avoid busy looping on rb_thread_fd_close

	We no longer use it this function, but extensions do, and
	we need to ensure it continues to work for them.

	* thread.c (rb_thread_fd_close): schedule other threads in loop
	* ext/-test-/thread_fd_close/thread_fd_close.c: new file
	* ext/-test-/thread_fd_close/depend: ditto
	* ext/-test-/thread_fd_close/extconf.rb: ditto
	* test/-ext-/thread_fd_close/test_thread_fd_close.rb: new test
	* properties.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	thread.c: avoid busy looping on rb_thread_fd_close

	We no longer use it this function, but extensions do, and
	we need to ensure it continues to work for them.

	* thread.c (rb_thread_fd_close): schedule other threads in loop
	* ext/-test-/thread_fd_close/thread_fd_close.c: new file
	* ext/-test-/thread_fd_close/depend: ditto
	* ext/-test-/thread_fd_close/extconf.rb: ditto
	* test/-ext-/thread_fd_close/test_thread_fd_close.rb: new test
	* properties.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 58284,58812,59028: [Backport #13632]</title>
<updated>2017-07-08T02:21:36+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-07-08T02:21:36+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=27251312111b7e25e347773e5777ee6072f9289b'/>
<id>27251312111b7e25e347773e5777ee6072f9289b</id>
<content type='text'>
	vm_core.h: ruby_error_stream_closed

	* vm_core.h (ruby_special_exceptions): renamed
	  ruby_error_closed_stream as ruby_error_stream_closed, like the
	  message.
	speed up IO#close with many threads

	Today, it increases IO#close performance with many threads:

	  Execution time (sec)
	  name            trunk   after
	  vm_thread_close 4.276   3.018

	  Speedup ratio: compare with the result of `trunk' (greater is better)
	  name            after
	  vm_thread_close 1.417

	This speedup comes because rb_notify_fd_close only scans threads
	inside rb_thread_io_blocking_region, not all threads in the VM.

	In the future, this type data structure may allow us to notify
	waiters of multiple FDs on a single thread (when using
	Fibers).

	* thread.c (struct waiting_fd): declare
	  (rb_thread_io_blocking_region): use on-stack list waiter
	  (rb_notify_fd_close): walk vm-&gt;waiting_fds instead
	  (call_without_gvl): remove old field setting
	  (th_init): ditto
	* vm_core.h (typedef struct rb_vm_struct): add waiting_fds list
	* (typedef struct rb_thread_struct): remove waiting_fd field
	  (rb_vm_living_threads_init): initialize waiting_fds list

	I am now kicking myself for not thinking about this 3 years ago
	when I introduced ccan/list in [Feature #9632] to optimize this
	same function :&lt;
	IO#close: do not enqueue redundant interrupts (take #2)

	Enqueuing multiple errors for one event causes spurious errors
	down the line, as reported by Nikolay Vashchenko in
	https://bugs.ruby-lang.org/issues/13632

	This should fix bad interactions with test_race_gets_and_close
	in test/ruby/test_io.rb since we ensure rb_notify_fd_close
	continues returning the busy flag after enqueuing the interrupt.

	Backporting changes to 2.4 and earlier releases will be more
	challenging...

	* thread.c (rb_notify_fd_close): do not enqueue multiple interrupts
	  [ruby-core:81581] [Bug #13632]
	* test/ruby/test_io.rb (test_single_exception_on_close):
	  new test based on script from Nikolay

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	vm_core.h: ruby_error_stream_closed

	* vm_core.h (ruby_special_exceptions): renamed
	  ruby_error_closed_stream as ruby_error_stream_closed, like the
	  message.
	speed up IO#close with many threads

	Today, it increases IO#close performance with many threads:

	  Execution time (sec)
	  name            trunk   after
	  vm_thread_close 4.276   3.018

	  Speedup ratio: compare with the result of `trunk' (greater is better)
	  name            after
	  vm_thread_close 1.417

	This speedup comes because rb_notify_fd_close only scans threads
	inside rb_thread_io_blocking_region, not all threads in the VM.

	In the future, this type data structure may allow us to notify
	waiters of multiple FDs on a single thread (when using
	Fibers).

	* thread.c (struct waiting_fd): declare
	  (rb_thread_io_blocking_region): use on-stack list waiter
	  (rb_notify_fd_close): walk vm-&gt;waiting_fds instead
	  (call_without_gvl): remove old field setting
	  (th_init): ditto
	* vm_core.h (typedef struct rb_vm_struct): add waiting_fds list
	* (typedef struct rb_thread_struct): remove waiting_fd field
	  (rb_vm_living_threads_init): initialize waiting_fds list

	I am now kicking myself for not thinking about this 3 years ago
	when I introduced ccan/list in [Feature #9632] to optimize this
	same function :&lt;
	IO#close: do not enqueue redundant interrupts (take #2)

	Enqueuing multiple errors for one event causes spurious errors
	down the line, as reported by Nikolay Vashchenko in
	https://bugs.ruby-lang.org/issues/13632

	This should fix bad interactions with test_race_gets_and_close
	in test/ruby/test_io.rb since we ensure rb_notify_fd_close
	continues returning the busy flag after enqueuing the interrupt.

	Backporting changes to 2.4 and earlier releases will be more
	challenging...

	* thread.c (rb_notify_fd_close): do not enqueue multiple interrupts
	  [ruby-core:81581] [Bug #13632]
	* test/ruby/test_io.rb (test_single_exception_on_close):
	  new test based on script from Nikolay

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 57968,57969,57970: [Backport #13313]</title>
<updated>2017-03-17T07:06:50+00:00</updated>
<author>
<name>naruse</name>
<email>naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-03-17T07:06:50+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=147107ce36eb1231fb79af066ab172d5003d3a1a'/>
<id>147107ce36eb1231fb79af066ab172d5003d3a1a</id>
<content type='text'>
	thread.c: thread_do_start

	* thread.c (thread_do_start): extract from a macro in
	  thread_start_func_2 for debugger.
	thread.c: Thread.start with Symbol

	* thread.c (thread_do_start): fix segfault at start with Symbol.
	  proc created by Symbol#to_proc does not have environment unless
	  using refinements.  [ruby-core:80147] [Bug #13313]
	Fiber also has same issue. [Bug #13313]

	* 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/branches/ruby_2_4@58003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	thread.c: thread_do_start

	* thread.c (thread_do_start): extract from a macro in
	  thread_start_func_2 for debugger.
	thread.c: Thread.start with Symbol

	* thread.c (thread_do_start): fix segfault at start with Symbol.
	  proc created by Symbol#to_proc does not have environment unless
	  using refinements.  [ruby-core:80147] [Bug #13313]
	Fiber also has same issue. [Bug #13313]

	* 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/branches/ruby_2_4@58003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 57948,57950: [Backport #13304]</title>
<updated>2017-03-13T09:28:35+00:00</updated>
<author>
<name>naruse</name>
<email>naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-03-13T09:28:35+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=319e440d0fa59c3cc269e6c7be556b4beb22c328'/>
<id>319e440d0fa59c3cc269e6c7be556b4beb22c328</id>
<content type='text'>
	thread.c: rb_thread_fd_close [ci skip]

	* thread.c (rb_thread_fd_close): re-define only for abi-check,
	  abort if called.  [ruby-core:80078] [Bug #13304]
	thread.c: rb_thread_fd_close [ci skip]

	* thread.c (rb_thread_fd_close): remove deprecated. a couple of
	  external libraries used it.  [ruby-core:80078] [Bug #13304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	thread.c: rb_thread_fd_close [ci skip]

	* thread.c (rb_thread_fd_close): re-define only for abi-check,
	  abort if called.  [ruby-core:80078] [Bug #13304]
	thread.c: rb_thread_fd_close [ci skip]

	* thread.c (rb_thread_fd_close): remove deprecated. a couple of
	  external libraries used it.  [ruby-core:80078] [Bug #13304]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
</feed>
