1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/core/io
normal 332b302f92 spec/ruby/core/io/select_spec.rb: workaround stuck IO.select
Under pipe page memory pressure on Linux, a pipe may only be
created with a single buffer[1].  And as of Linux v4.18, the
fs/pipe.c::pipe_poll callback does not account for merging
done in fs/pipe::pipe_write; only the number of usable buffers
in the pipe.  Thus it is possible for a pipe to be writable
(if only by a small amount) despite IO.select saying it is not.

With the default 16384 /proc/sys/fs/pipe-user-pages-soft value
and the pipe having 16 pages of buffers, this issue is trivially
reproducible by creating 1024 pipes in a background process
before running the spec:

  $ ulimit -n 2053 # or something higher
  $ ./miniruby -e '1024.times.map { IO.pipe }; sleep' &
  $ make test-spec MSPECOPT=spec/ruby/core/io/select_spec.rb

So, we create a new pipe we never write to for testing
writability of IO.select.  This may cause the test to fail with
ENFILE on an overloaded system, but at least that's an obvious
failure (unlike having a test get stuck).  This should reduce
failures on our overloaded CI machines:

   http://ci.rvm.jp/results/trunk-nopara@silicon-docker/1239426

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/pipe.c?h=v4.18#n642

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-20 01:43:10 +00:00
..
fixtures
shared Update to ruby/spec@9be7c7e 2018-08-03 16:19:40 +00:00
advise_spec.rb
binmode_spec.rb
binread_spec.rb
binwrite_spec.rb
bytes_spec.rb
chars_spec.rb
close_on_exec_spec.rb
close_read_spec.rb
close_spec.rb
close_write_spec.rb
closed_spec.rb
codepoints_spec.rb
constants_spec.rb
copy_stream_spec.rb
dup_spec.rb
each_byte_spec.rb
each_char_spec.rb
each_codepoint_spec.rb
each_line_spec.rb
each_spec.rb
eof_spec.rb
external_encoding_spec.rb
fcntl_spec.rb
fdatasync_spec.rb
fileno_spec.rb
flush_spec.rb
for_fd_spec.rb
foreach_spec.rb
fsync_spec.rb
getbyte_spec.rb
getc_spec.rb
gets_spec.rb
initialize_spec.rb
inspect_spec.rb
internal_encoding_spec.rb
io_spec.rb
ioctl_spec.rb
isatty_spec.rb
lineno_spec.rb
lines_spec.rb
new_spec.rb
open_spec.rb
output_spec.rb
pid_spec.rb
pipe_spec.rb
popen_spec.rb
pos_spec.rb Update to ruby/spec@a454137 2018-06-27 12:30:05 +00:00
print_spec.rb Update to ruby/spec@a454137 2018-06-27 12:30:05 +00:00
printf_spec.rb
putc_spec.rb
puts_spec.rb
read_nonblock_spec.rb
read_spec.rb Update to ruby/spec@9be7c7e 2018-08-03 16:19:40 +00:00
readbyte_spec.rb
readchar_spec.rb
readline_spec.rb
readlines_spec.rb
readpartial_spec.rb
reopen_spec.rb
rewind_spec.rb
seek_spec.rb
select_spec.rb spec/ruby/core/io/select_spec.rb: workaround stuck IO.select 2018-08-20 01:43:10 +00:00
set_encoding_spec.rb
stat_spec.rb
sync_spec.rb
sysopen_spec.rb
sysread_spec.rb
sysseek_spec.rb
syswrite_spec.rb
tell_spec.rb
to_i_spec.rb
to_io_spec.rb
try_convert_spec.rb
tty_spec.rb
ungetbyte_spec.rb
ungetc_spec.rb
write_nonblock_spec.rb
write_spec.rb