Bug #8770
[PATCH] process.c: avoid EINTR from Process.spawn
Description
(send_child_error): retry write on EINTR
(recv_child_error): retry read on EINTR
I've been getting occasional Errno::EINTR from Process.spawn with
just the prog name in the error message. This is probably the cause
of it, as I haven't been able to get a consistent reproduction of
the Errno::EINTR.
I've been hitting this on 2.0.0-p247, so it probably needs backport.
Associated revisions
- process.c (READ_FROM_CHILD): Apply the last hunk of 0001-process.c-avoid-EINTR-from-Process.spawn.patch written by Eric Wong in [Bug #8770].
- process.c (READ_FROM_CHILD): Apply the last hunk of 0001-process.c-avoid-EINTR-from-Process.spawn.patch written by Eric Wong in [Bug #8770].
- process.c (READ_FROM_CHILD): Apply the last hunk of 0001-process.c-avoid-EINTR-from-Process.spawn.patch written by Eric Wong in [Bug #8770].
- process.c (READ_FROM_CHILD): Apply the last hunk of 0001-process.c-avoid-EINTR-from-Process.spawn.patch written by Eric Wong in [Bug #8770].
- process.c (READ_FROM_CHILD): Apply the last hunk of 0001-process.c-avoid-EINTR-from-Process.spawn.patch written by Eric Wong in [Bug #8770].
merge revision(s) 44687,44706,44727: [Backport #8770]
* process.c (recv_child_error): Fix deadlock in rb_fork_internal when a
signal is sent to the parent process while Ruby is forking in IO.popen.
Patch by Scott Francis. Closes GH-513.
* process.c (send_child_error): retry write on EINTR to fix
occasional Errno::EINTR from Process.spawn.
* process.c (recv_child_error): retry read on EINTR to fix occasional Errno::EINTR from Process.spawn. * process.c (READ_FROM_CHILD): Apply the last hunk of 0001-process.c-avoid-EINTR-from-Process.spawn.patch written by Eric Wong in [Bug #8770].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
History
#1
[ruby-core:56530]
Updated by nobu (Nobuyoshi Nakada) about 5 years ago
patch please
#2
[ruby-core:56535]
Updated by normalperson (Eric Wong) about 5 years ago
- File 0001-process.c-avoid-EINTR-from-Process.spawn.patch 0001-process.c-avoid-EINTR-from-Process.spawn.patch added
Oops, attached
#3
[ruby-core:57245]
Updated by naruse (Yui NARUSE) almost 5 years ago
- Status changed from Open to Assigned
- Assignee set to nobu (Nobuyoshi Nakada)
#4
[ruby-core:60073]
Updated by normalperson (Eric Wong) over 4 years ago
It looks like r44687 implements a partial fix for this, but my
proposed patch covers more cases and is more complete.
* process.c (recv_child_error): Fix deadlock in rb_fork_internal when a signal is sent to the parent process while Ruby is forking in IO.popen. Patch by Scott Francis. Closes GH-513.
#5
[ruby-core:60091]
Updated by nobu (Nobuyoshi Nakada) over 4 years ago
- Status changed from Assigned to Closed
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED
Oops, I missed to include the reference in r44706.
#6
[ruby-core:60096]
Updated by normalperson (Eric Wong) over 4 years ago
nobu@ruby-lang.org wrote:
Oops, I missed to include the reference in r44706.
No worries. Interesting, now I notice test_process now fails under
heavy load with this patch...
This should fix things: http://bogomips.org/ruby.git/patch?id=81b6f37afe34
git://80x24.org/ruby.git test_process-avoid-teardown
#7
[ruby-core:60102]
Updated by nobu (Nobuyoshi Nakada) over 4 years ago
Is it an issue of the test code?
http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20140125T233302Z.log.html.gz
#8
[ruby-core:60103]
Updated by normalperson (Eric Wong) over 4 years ago
nobu@ruby-lang.org wrote:
Is it an issue of the test code?
http://c5664.rubyci.org/~chkbuild/ruby-trunk/log/20140125T233302Z.log.html.gz
Odd, I did not get this:
10) Error:
TestProcess#test_deadlock_by_signal_at_forking:
Errno::EINTR: Interrupted system call - /home/chkbuild/build/20140125T233302Z/ruby/ruby
/home/chkbuild/build/20140125T233302Z/ruby/test/ruby/test_process.rb:1875:in popen'block in test_deadlock_by_signal_at_forking'
/home/chkbuild/build/20140125T233302Z/ruby/test/ruby/test_process.rb:1875:in
/home/chkbuild/build/20140125T233302Z/ruby/test/ruby/test_process.rb:1873:in times'test_deadlock_by_signal_at_forking'
/home/chkbuild/build/20140125T233302Z/ruby/test/ruby/test_process.rb:1873:in
Instead, I got this (with TESTS=-j32):
/home/ew/ruby/test/ruby/test_process.rb:15:in waitall': SIGTERM (SignalException)teardown'
/home/ew/ruby/test/ruby/test_process.rb:15:in
/home/ew/ruby/lib/minitest/unit.rb:1280:in `block in run'
I don't think I was able to reproduce it on a single-threaded test-all.
#9
[ruby-core:60172]
Updated by akr (Akira Tanaka) over 4 years ago
#10
[ruby-core:60180]
Updated by normalperson (Eric Wong) over 4 years ago
akr@fsij.org wrote:
I think the Errno::EINTR error occur inTestProcess#test_deadlock_by_signal_at_forking because
r44706 doesn't contain the last hunk in 0001-process.c-avoid-EINTR-from-Process.spawn.patch.I committed the hunk at r44727.
Good catch, things look good, thanks!
#11
[ruby-core:60857]
Updated by tmm1 (Aman Gupta) over 4 years ago
- Tracker changed from Bug to Backport
- Target version deleted (
2.1.0) - Project changed from Ruby trunk to Backport21
- Category deleted (
core) - Status changed from Closed to Assigned
#12
[ruby-core:60884]
Updated by naruse (Yui NARUSE) over 4 years ago
- Tracker changed from Backport to Bug
- Project changed from Backport21 to Ruby trunk
- ruby -v set to -
- Backport set to 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
#13
[ruby-core:60885]
Updated by naruse (Yui NARUSE) over 4 years ago
- ruby -v changed from - to 44687,44706,44727
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED
COMMITS: 44687,44706,44727
#14
[ruby-core:60886]
Updated by naruse (Yui NARUSE) over 4 years ago
- Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: DONE
r45061 on ruby_2_1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e