Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions test/stress.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,9 @@

# test for proper handling of FD exhaustion
if Sys.isunix()
let ps = Pipe[]
ulimit_n = tryparse(Int, readchomp(`sh -c 'ulimit -n'`))
try
for i = 1:100*something(ulimit_n, 1000)
p = Pipe()
Base.link_pipe!(p)
push!(ps, p)
end
if ulimit_n === nothing
@warn "`ulimit -n` is set to unlimited, fd exhaustion cannot be tested"
@test_broken false
else
@test false
end
catch ex
isa(ex, Base.IOError) || rethrow()
@test ex.code in (Base.UV_EMFILE, Base.UV_ENFILE)
finally
foreach(close, ps)
end
end
# Run this test with a really small ulimit. If the ulimit is too high,
# we might saturate kernel resources (See #23143)
run(`sh -c "ulimit -n 100; $(Base.shell_escape(Base.julia_cmd())) --startup-file=no $(joinpath(@__DIR__, "stress_fd_exec.jl"))"`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t the whole command (especially the user path) have been inside the shell_escape call?

end

# issue 13559
Expand Down
22 changes: 22 additions & 0 deletions test/stress_fd_exec.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Test
let ps = Pipe[]
ulimit_n = tryparse(Int, readchomp(`sh -c 'ulimit -n'`))
try
for i = 1:100*something(ulimit_n, 1000)
p = Pipe()
Base.link_pipe!(p)
push!(ps, p)
end
if ulimit_n === nothing
@warn "`ulimit -n` is set to unlimited, fd exhaustion cannot be tested"
@test_broken false
else
@test false
end
catch ex
isa(ex, Base.IOError) || rethrow()
@test ex.code in (Base.UV_EMFILE, Base.UV_ENFILE)
finally
foreach(close, ps)
end
end