Project

General

Profile

Actions

Bug #8770

closed

[PATCH] process.c: avoid EINTR from Process.spawn

Added by normalperson (Eric Wong) over 10 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
44687,44706,44727
Backport:
[ruby-core:56524]

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.


Files

0001-process.c-avoid-EINTR-from-Process.spawn.patch (3.18 KB) 0001-process.c-avoid-EINTR-from-Process.spawn.patch avoid EINTR from Process.spawn normalperson (Eric Wong), 08/11/2013 11:39 AM

Updated by naruse (Yui NARUSE) over 10 years ago

  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

Updated by normalperson (Eric Wong) about 10 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.

Updated by nobu (Nobuyoshi Nakada) about 10 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.

Updated by normalperson (Eric Wong) about 10 years ago

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

Updated by normalperson (Eric Wong) about 10 years ago

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:

  1. 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' /home/chkbuild/build/20140125T233302Z/ruby/test/ruby/test_process.rb:1875:in block in test_deadlock_by_signal_at_forking'
    /home/chkbuild/build/20140125T233302Z/ruby/test/ruby/test_process.rb:1873:in times' /home/chkbuild/build/20140125T233302Z/ruby/test/ruby/test_process.rb:1873:in test_deadlock_by_signal_at_forking'

Instead, I got this (with TESTS=-j32):

/home/ew/ruby/test/ruby/test_process.rb:15:in waitall': SIGTERM (SignalException) /home/ew/ruby/test/ruby/test_process.rb:15:in teardown'
/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.

Updated by akr (Akira Tanaka) about 10 years ago

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.

Updated by normalperson (Eric Wong) about 10 years ago

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!

Updated by tmm1 (Aman Karmani) about 10 years ago

  • Tracker changed from Bug to Backport
  • Target version deleted (2.1.0)
  • Project changed from Ruby master to Backport21
  • Category deleted (core)
  • Status changed from Closed to Assigned

Updated by naruse (Yui NARUSE) about 10 years ago

  • Tracker changed from Backport to Bug
  • Project changed from Backport21 to Ruby master
  • ruby -v set to -
  • Backport set to 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN

Updated by naruse (Yui NARUSE) about 10 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

Updated by naruse (Yui NARUSE) about 10 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

Actions #15

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Status changed from Assigned to Closed
  • Backport deleted (1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: DONE)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0