mirror of
https://github.com/rubyjs/mini_racer
synced 2023-03-27 23:21:28 -04:00
FIX: ensure we release pipe fds early
Previously we relied on GC to release pipe fds. This worked on earlier versions of Ruby but on 2.7 it will start breaking. We now release the fds early to avoid the issues.
This commit is contained in:
parent
9593ff3569
commit
b5ef1d1ab6
5 changed files with 24 additions and 4 deletions
|
@ -3,6 +3,7 @@ rvm:
|
|||
- 2.3
|
||||
- 2.4
|
||||
- 2.5
|
||||
- 2.6
|
||||
- ruby-head
|
||||
matrix:
|
||||
include:
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
|
||||
- 0.2.7
|
||||
|
||||
- 11-11-2019
|
||||
|
||||
- FIX: release the file descriptor for timeout pipe earlier (this avoids holding too many files open in Ruby 2.7)
|
||||
|
||||
- 14-05-2019
|
||||
|
||||
- 0.2.6
|
||||
|
|
|
@ -315,7 +315,9 @@ module MiniRacer
|
|||
t.join
|
||||
|
||||
rval
|
||||
|
||||
ensure
|
||||
wp.close if wp
|
||||
rp.close if rp
|
||||
end
|
||||
|
||||
def check_init_options!(options)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module MiniRacer
|
||||
VERSION = "0.2.6"
|
||||
VERSION = "0.2.7"
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'securerandom'
|
||||
require 'date'
|
||||
require 'test_helper'
|
||||
|
@ -731,7 +733,7 @@ raise FooError, "I like foos"
|
|||
isolate = MiniRacer::Isolate.new
|
||||
context = MiniRacer::Context.new(isolate: isolate)
|
||||
context.dispose
|
||||
context2 = MiniRacer::Context.new(isolate: isolate) # Received signal 11 SEGV_MAPERR
|
||||
_context2 = MiniRacer::Context.new(isolate: isolate) # Received signal 11 SEGV_MAPERR
|
||||
end
|
||||
|
||||
def test_context_starts_with_no_isolate_value
|
||||
|
@ -757,7 +759,6 @@ raise FooError, "I like foos"
|
|||
end
|
||||
|
||||
def test_heap_dump
|
||||
|
||||
f = Tempfile.new("heap")
|
||||
path = f.path
|
||||
f.unlink
|
||||
|
@ -771,6 +772,15 @@ raise FooError, "I like foos"
|
|||
assert dump.length > 0
|
||||
|
||||
FileUtils.rm(path)
|
||||
end
|
||||
|
||||
def test_pipe_leak
|
||||
# in Ruby 2.7 pipes will stay open for longer
|
||||
# make sure that we clean up early so pipe file
|
||||
# descriptors are not kept around
|
||||
context = MiniRacer::Context.new(timeout: 1000)
|
||||
10000.times do |i|
|
||||
context.eval("'hello'")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue