* signal.c (sigchld_hit): if SIGCHLD is not available, this variable
never sets.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Arbitrarily closing file descriptors on exec breaks use cases
where a Ruby process sets up a descriptor for non-Ruby children
to use. For example, the "rake foo" target may spawn any number
of subprocesses (Ruby or not) which depends on parsing the "FOO"
environment variable for out_fd:99 and writing to foo.out
FOO=out_fd:99 rake foo 99>>foo.out
Unfortunately, this introduced one incompatibility in
test/lib/test/unit.rb and it now requires explicitly setting
IO#close_on_exec=true
[ruby-core:88007] [Misc #14907]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
We (the thread acquiring the mutex) need to acquire the mutex
before being killed to work with ConditionVariable#wait.
Thus we reinstate the acquire-immediately-after-sleeping logic
from pre-r63711 while still retaining the
acquire-after-checking-for-interrupts logic from r63711.
This regression was introduced in
commit 501069b8a4 (r63711)
("thread_sync.c (rb_mutex_lock): fix deadlock") for
[Bug #14841]
[ruby-core:88503] [Bug #14999] [Bug #14841]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.ac (LIBPATHENV): use DYLD_FALLBACK_LIBRARY_PATH instead of
DYLD_LIBRARY_PATH on macOS, to honor runtime paths embedded in the
binaries. [ruby-core:88487] [Bug #14992]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Makefile.in (ruby.pc, ruby-runner.h): fix missing dependencies.
config.status is needed to be up to date, to run it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Same reasoning as the disarm in rb_sigwait_fd_get, the current
thread is already processing signals, so we do not need
UBF_TIMER to continually kick the process, anymore.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
We do not need to rely on SIGVTALRM for non-sighandler wakeups.
This will reduce spurious wakeups in cases where sigwait_fd
is not grabbed again, soon.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
For (rare) blocking functions which are not affected by signals,
we need to call the appropriate unblocking function via
`threadptr_trap_interrupt'
While we're at it, handling waitpid/SIGCHLD from gvl.timer isn't
harmful, here.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
It is possible for Mutex#sleep (via ConditionVariable#wait)
to prematurely wake up under MJIT (because Mutex#sleep can't
handle spurious wakeups). This affects @idle_done_cond in
Net::IMAP#idle and means the response handler may never
set `in_idle' to `true`.
In any case, ensure the infinite looping `raiser' thread
stops running when the test is done.
Will work on reducing the effect of spurious wakeups from
MJIT...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
I still seem to need more memory for parallel tests with MJIT...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This hopefully clarifies the roles of UBF_TIMER and vm->gvl.timer
[ruby-core:88475] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
On a 64-bit system, this reduces rb_thread_t from 536 to 520 bytes.
Depending on the allocation, this can reduce cacheline access
for checking the abort_on_exception, report_on_exception and
pending_interrupt_queue_checked flags.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Do not waste extra memory for each thread, but make
thread_pthread.c easier-to-follow as a result.
[ruby-core:88475] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
that times out with test-all w/ --jit-wait.
I'm running the following command on Wecker CI everyday:
```
make test-all TESTOPTS="--color=never --job-status=normal" RUN_OPTS="--disable-gems --jit-wait --jit-warnings" RUBY_FORCE_TEST_JIT=1
```
By running yesterday's all commits, r64354 ran successfully but r64355
didn't. So the test should be fixed to run with --jit-wait at first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
These functions will not be exported outside of thread_pthread.c
and we need to clarify the timer here is used for ubf and not
timeslice.
[ruby-core:88475] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This data structure has nothing to do with timers or threads.
[ruby-core:88475] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Hopefully this makes the code easier-to-follow
[ruby-core:88475] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Let me skip this to make CI green first and take a look later...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Currently all tests are skipped by the --name option.
V=1 is for debugging this issue.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Based on patch by akr [ruby-core:88477], use Tempfile.create
to avoid unnecessary unlink call. Unlike akr's original patch,
this does not change the return value of flush.
Thanks-to: Tanaka Akira <akr@fsij.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reverts commit 52102f6ff5 (r64238).
It is no longer necessary if we use Tempfile.create in
WEBrick::HTTPAuth::Htgroup#flush (see next commit)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_io_wait_readable and rb_io_wait_writable depend on the TSD
errno value. Due to the recent changes in r64352-r64353 to
restructure GVL, errno could be set to EAGAIN from the signal
self-pipe and cause the rb_io_wait_readable spec to block
unexpectedly. This should fix rubyspec timeouts on Solaris:
http://rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20180814T042506Z.fail.html.gz
* spec/ruby/optional/capi/ext/io_spec.c: add errno= setter method
* spec/ruby/optional/capi/io_spec.rb: set errno to appropriate values for tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
I'm not sure what's causing this failure in Solaris and only
on rubyspec, since rb_io_wait_readable is a well-exercised
code path in other places. But maybe using a pthread for
timing (similar to old timer-thread) can solve the issue.
cf. http://rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20180814T042506Z.fail.html.gz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
timer_create does not seem to support CLOCK_MONOTONIC on Solaris,
and CLOCK_HIRES seems like it could fail with insufficient permissions:
https://docs.oracle.com/cd/E86824_01/html/E54766/timer-create-3c.html
(Only tested on Linux and FreeBSD)
[ruby-core:88360] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
EINTR seems unavoidable in real programs (or MJIT), so maybe
it's not worth dealing with. r64353 relies on POSIX timers
to signal.
Switching pipes and sockets to non-blocking by default would let
us get rid of POSIX timers, timer pthread and this hack:
https://bugs.ruby-lang.org/issues/14968
[ruby-core:88360] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
It looks like I forgot to account for a situation involving 3
threads.
[ruby-core:88360] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This closes race condition where GVL is uncontended and a thread
receives a signal immediately before calling the blocking
function when releasing GVL:
1) check interrupts
2) release GVL
3) blocking function
If signal fires after 1) but before 3), that thread may never
wake up if GVL is uncontended
We also need to wakeup the ubf_list unconditionally on
gvl_yield; because two threads can be yielding to each other
while waiting on IO#close while waiting on threads in IO#read or
IO#gets.
[ruby-core:88360] [Misc #14937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e