diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-03 19:49:54 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-03 19:49:54 +0000 |
commit | a2264342063260d660b99872eaf5080f6ab08e81 (patch) | |
tree | eedca3766bf9e66d016518d9bfe13a5b4e3a6f7a /test/ruby/test_process.rb | |
parent | 5ce533520eb7bc797cee18848d1f7076b7f40a62 (diff) |
process.c: fix ETXTBUSY from MJIT compiler process
This affects test/ruby/test_process.rb (test_execopt_env_path).
Since MJIT uses vfork+execve in a separate thread, there can be
small window in-between vfork and execve where tmp_script.cmd is
held open by the vforked child. vfork only pauses the MJIT
thread, not any Ruby Threads, so our call to Process.spawn will
hit ETXTBUSY in that window unless we fork.
main thread | MJIT thread
----------------------------------------------------
fd = open(tmp) | |
| vfork for CC | CC running
write | | ---------------
fchmod | | sees "fd" here
close(fd) | |
Process.spawn called | |
vfork (spawn)| (new process) | |
| execve => TXTBUSY | |
| | | execve (FD_CLOEXEC on fd)
| | vfork returns |
Holding the waitpid_lock whenever we intend to spawn a process
prevents the MJIT thread from spawning a process while we are
spawning in Ruby-land.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r-- | test/ruby/test_process.rb | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 4c212c13f2..816751ec81 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -343,11 +343,6 @@ class TestProcess < Test::Unit::TestCase end def test_execopt_env_path - # http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1455223 - # http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1450027 - # http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1469867 - skip 'this randomly fails with MJIT' if RubyVM::MJIT.enabled? - bug8004 = '[ruby-core:53103] [Bug #8004]' Dir.mktmpdir do |d| open("#{d}/tmp_script.cmd", "w") {|f| f.puts ": ;"; f.chmod(0755)} |