summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
AgeCommit message (Collapse)Author
2018-08-17passing non-stdio fds is not supported on Windowsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-16process.c: defaults to close_others falsenormal
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
2018-08-13thread_pthread.c: eliminate timer thread by restructuring GVLnormal
This reverts commit 194a6a2c68e9c8a3536b24db18ceac87535a6051 (r64203). Race conditions which caused the original reversion will be fixed in the subsequent commit. [ruby-core:88360] [Misc #14937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-06thread_pthread.c: restore timer-thread for now :<normal
[ruby-core:88306] Revert "process.c: ensure th->interrupt lock is held when migrating" This reverts commit 5ca416bdf6b6785cb20f139c2c514eda005fe42f (r64201) Revert "process.c (rb_waitpid): reduce sigwait_fd bouncing" This reverts commit 217bdd776fbeea3bfd0b9324eefbfcec3b1ccb3e (r64200). Revert "test/ruby/test_thread.rb (test_thread_timer_and_interrupt): add timeouts" This reverts commit 9f395f11202fc3c7edbd76f5aa6ce1f8a1e752a9 (r64199). Revert "thread_pthread.c (native_sleep): reduce ppoll sleeps" This reverts commit b3aa256c4d43d3d7e9975ec18eb127f45f623c9b (r64193). Revert "thread.c (consume_communication_pipe): do not retry after short read" This reverts commit 291a82f748de56e65fac10edefc51ec7a54a82d4 (r64185). Revert "test/ruby/test_io.rb (test_race_gets_and_close): timeout each thread" This reverts commit 3dbd8d1f66537f968f0461ed8547460b3b1241b3 (r64184). Revert "thread_pthread.c (gvl_acquire_common): persist timeout across calls" This reverts commit 8c2ae6e3ed072b06fc3cbc34fa8a14b2acbb49d5 (r64165). Revert "test/ruby/test_io.rb (test_race_gets_and_close): use SIGABRT on timeout" This reverts commit 931cda4db8afd6b544a8d85a6815765a9c417213 (r64135). Revert "thread_pthread.c (gvl_yield): do ubf wakeups when uncontended" This reverts commit 508f00314f46c08b6e9b0141c01355d24954260c (r64133). Revert "thread_pthread.h (native_thread_data): split condvars on some platforms" This reverts commit a038bf238bd9a24bf1e1622f618a27db261fc91b (r64124). Revert "process.c (waitpid_nogvl): prevent conflicting use of sleep_cond" This reverts commit 7018acc946882f21d519af7c42ccf84b22a46b27 (r64117). Revert "thread_pthread.c (rb_sigwait_sleep): th may be 0 from MJIT" This reverts commit 56491afc7916fb24f5c4dc2c632fb93fa7063992 (r64116). Revert "thread*.c: waiting on sigwait_fd performs periodic ubf wakeups" This reverts commit ab47a57a46e70634d049e4da20a5441c7a14cdec (r64115). Revert "thread_pthread.c (gvl_destroy): make no-op on GVL bits" This reverts commit 95cae748171f4754b97f4ba54da2ae62a8d484fd (r64114). Revert "thread_pthread.c (rb_sigwait_sleep): fix uninitialized poll set in UBF case" This reverts commit 4514362948fdb914c6138b12d961d92e9c0fee6c (r64113). Revert "thread_pthread.c (rb_sigwait_sleep): re-fix [Bug #5343] harder" This reverts commit 26b8a70bb309c7a367b9134045508b5b5a580a77 (r64111). Revert "thread.c: move ppoll wrapper into thread_pthread.c" This reverts commit 3dc7727d22fecbc355597edda25d2a245bf55ba1 (r64110). Revert "thread.c: move ppoll wrapper before thread_pthread.c" This reverts commit 2fa1e2e3c3c5c4b3ce84730dee4bcbe9d81b8e35 (r64109). Revert "thread_pthread.c (ubf_select): refix [Bug #5343]" This reverts commit 4c1ab82f0623eca91a95d2a44053be22bbce48ad (r64108). Revert "thread_win32.c: suppress warnings by -Wsuggest-attribute" This reverts commit 6a9b63e39075c53870933fbac5c1065f7d22047c (r64159). Revert "thread_pthread: remove timer-thread by restructuring GVL" This reverts commit 708bfd21156828526fe72de2cedecfaca6647dc1 (r64107). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-05test/ruby/test_process.rb (test_wait_and_sigchld): allow extra SIGCHLDnormal
MJIT way generate an extra SIGCHLD, so we'll have to deal with it. Any realistic Ruby program may hit unexpected SIGCHLD, too, since any spawned subprocess could have extra grandchildren which get reaped by the main Ruby process, and SIGCHLD may be sent spuriously by an external process using kill(2) syscall (via kill(1) or Process.kill). cf. http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1194620 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-29thread_pthread: remove timer-thread by restructuring GVLnormal
To reduce resource use and reduce CI failure; remove timer-thread. Single-threaded Ruby processes (including forked children) will never see extra thread overhead. This prevents glibc and jemalloc from going into multi-threaded mode and initializing locks or causing fragmentation via arena explosion. The GVL is implements its own wait-queue as a ccan/list to permit controlling wakeup order. Timeslice under contention is handled by a designated timer thread (similar to choosing a "patrol_thread" for current deadlock checking). There is only one self-pipe, now, as wakeups for timeslice are done independently using condition variables. This reduces FD pressure slightly. Signal handling is handled directly by a Ruby Thread (instead of timer-thread) by exposing signal self-pipe to callers of rb_thread_fd_select, native_sleep, rb_wait_for_single_fd, etc... Acquiring, using, and releasing the self-pipe is exposed via 4 new internal functions: 1) rb_sigwait_fd_get - exclusively acquire timer_thread_pipe.normal[0] 2) rb_sigwait_fd_sleep - sleep and wait for signal (and no other FDs) 3) rb_sigwait_fd_put - release acquired result from rb_sigwait_fd_get 4) rb_sigwait_fd_migrate - migrate signal handling to another thread after calling rb_sigwait_fd_put. rb_sigwait_fd_migrate is necessary for waitpid callers because only one thread can wait on self-pipe at a time, otherwise a deadlock will occur if threads fight over the self-pipe. TRAP_INTERRUPT_MASK is now set for the main thread directly in signal handler via rb_thread_wakeup_timer_thread. Originally, I wanted to use POSIX timers (timer_create/timer_settime) for this. Unfortunately, this proved unfeasible as Mutex#sleep resumes on spurious wakeups and test/thread/test_cv.rb::test_condvar_timed_wait failed. Using pthread_sigmask to mask out SIGVTALRM fixed that test, but test/fiddle/test_function.rb::test_nogvl_poll proved there'd be some unavoidable (and frequent) incompatibilities from that approach. Finally, this allows us to drop thread_destruct_lock and interrupt current ec directly. We don't need to rely on vm->thread_destruct_lock or a coherent vm->running_thread on any platform. Separate timer-thread for time slice and signal handling is relegated to thread_win32.c, now. [ruby-core:88088] [Misc #14937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-29test/ruby/test_process.rb (test_wait_and_sigchld): improve reliabilitynormal
This should fix CI failure under MJIT, 100ms wait may not be enough for signal handler to fire: http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1169472 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05unrevert r63852 but keep SIGCHLD path disabled for win32normal
Reading win32/win32.c waitpid implementation, maybe waitpid(-1, ...) on that platform will never conflict with mjit use of waitpid. In any case, I've added WAITPID_USE_SIGCHLD macro to vm_core.h so it can be easy for Linux/BSD users to test (hopefully!) win32-compatible code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-04Revert r63758 and related commitsnaruse
The change is unstable on Windows. Please re-commit it when it correctly supports Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-29test_process.rb (test_wait_exception): check assertion soonernormal
To diagnose f.puts => EPIPE failures in CI(*). I'm not sure what's wrong and can't reproduce EPIPE even with my slow laptop from 2005. (*) http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/1058203 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27tests: increase timeouts and speedup some slow testsnormal
I'm still using the computer from 2005, so enabling MJIT makes some tests take longer. For test_deadlock_by_signal_at_forking I got it down to 135s to 89s by disabling RubyGems. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27Revert "test_process.rb: skip tests for Bug 14867"normal
This reverts r63740 (commit 042395a7f7262464265ce70cdffbe1812aa145d3). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-24test_process.rb: skip tests for Bug 14867k0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-15gettimeofday is obsoletenobu
* test/ruby/test_process.rb gettimeofday is obsolete in SUSv4, and may not be available in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22test_process.rb: assert minimum maxgroupsnobu
* test/ruby/test_process.rb (TestProcess#test_maxgroups): maxgroups should be one at least. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-21test_process.rb: unlimited getgroups on darwinnobu
* test/ruby/test_process.rb (TestProcess#test_maxgroups): Darwin extension of getgroups(2) which is not limited to MAXGROUPS is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31io.c: fptr_copy_finalizernobu
* io.c (fptr_copy_finalizer): remove fptr from pipe_list when pipe became ordinary file, to fix access after free. to be finalized by pipe_finalize and being in pipe_list must match. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31io.c: pipe_register_fptrnobu
* io.c (pipe_register_fptr): get rid of double registration which causes access after free and segfault. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31trick ruby-mode.el by heredocsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-06test_process.rb: skip not-found groupsnobu
* test/ruby/test_process.rb (test_execopts_gid): under some network configuration (maybe with Open Directory but disconnected temporarily), some groups may fail to find. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-25test/ruby/test_process.rb: get rid of timing issuenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-20extend timeout limit.ko1
* test/ruby/test_process.rb (test_threading_works_after_exec_fail): extend timeout limit from 30 to 90 because some test nodes fails with timeout error. Also use a Queue instead of a local variable to communicate with threads. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19skip test_aspawn_too_long_path on Solaris 10 or earlierngoto
* test/ruby/test_process.rb (TestProcess#test_aspawn_too_long_path): skip test_aspawn_too_long_path on Solaris 10 or earlier versions because they lack Process::RLIMIT_NPROC and the test creates extraordinary number of processes that makes the system unstable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-13test_process.rb: fix error when empty groupsnobu
* test/ruby/test_process.rb (test_maxgroups): set one element at least get rid of ZeroDivisionError when no process groups. [ruby-core:84224] [Bug #14174] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Fix test-all tests to avoid creating report_on_exception warningseregon
* The warnings are shown by Thread.report_on_exception defaulting to true. [Feature #14143] [ruby-core:83979] * Improves tests by narrowing down the scope where an exception is expected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12process.c: add Process.last_statusmrkn
* process.c (proc_s_last_status): add Process.last_status [ruby-core:83514] [Feature #14043] * test/ruby/test_process.rb (test_last_status): add a test case for Process.last_status. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-09test_process.rb (test_maxgroups): add assertionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-11process.c: null byte at initgroupsnobu
* process.c (proc_initgroups): check null byte. patched by tommy (Masahiro Tomita) in [ruby-dev:50287]. [Bug #13995] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-20process: block/unblock signals around forknormal
As with forking for execve(2) in `spawn', we must block signals to ensure they are handled correctly in a freshly `fork'-ed child. * process.c (retry_fork_ruby): block/unblock signals around fork (rb_fork_ruby): re-enable signals in forked child * test/ruby/test_process.rb (test_forked_child_signal): new test [ruby-core:82883] [Bug #13916] Thanks to Russell Davis for the bug report and test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14process.c: null bytesnobu
* process.c (rlimit_type_by_sym): prohibit null bytes in key names. [ruby-core:82033] [Bug #13744] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-13process.c: handle dynamic :rlimit_* symbols in spawn execoptsnormal
* process.c (rb_execarg_addopt_rlimit): hoist out of rb_execarg_addopt (rlimit_type_by_sym): new wrapper for dynamic symbol (rb_execarg_addopt): check for dsym via rlimit_type_by_sym * test/ruby/test_process.rb (test_execopts_rlimit): check dsym w/o pindown Add extra check for bogus rlimit args, too. [ruby-core:82033] [Bug #13744] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16test_process.rb: compare in UTF-8nobu
* test/ruby/test_process.rb (test_execopts_open_chdir_m17n_path): compare directory name in UTF-8. encoding of `Dir.pwd` is affected by filesystem encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07Extend timeout for Solaris unstable10s.shugo
http://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-trunk/log/20161206T181910Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-01Wait until excpetion handling is ready.shugo
Because RubyCI on Solaris 10 failed as follows: 1) Failure: TestProcess#test_execopts_redirect_open_fifo_interrupt_raise [/export/home/rubyci/unstable10s/tmp/build/20161130T201909Z/ruby/test/ruby/test_process.rb:646]: <"ok\n"> expected but was <"">. The argument of sleep (0.5) can be smaller, but I'm not sure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-10test_process.rb: fix pgroup testnobu
* test/ruby/test_process.rb (TestProcess#test_execopts_pgroup): use dynamically assigned pid for the process group, instead of a magic number 2. [ruby-core:78051] [Bug #12909] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-06process.c: PATH env in spawnnobu
* process.c (rb_exec_fillarg): honor the given path environment variable. [ruby-core:53103] [Bug #8004] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-14process.c: use uaspawnnobu
* process.c (proc_exec_cmd): use UTF-8 version aspawn. [ruby-dev:49838] [Bug #12841] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-06process.c: argument types over conversionnobu
* process.c (rb_exec_getargs): honor the expected argument types over the conversion method. the basic language functionality should be robust. [ruby-core:75388] [Bug #12355] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-06* test/ruby/test_process.rb (test_execopts_gid): Skip a testodaira
that is known to fail on AIX. AIX allows setgid to a supplementary group, but Ruby does not allow the "-e" option when setgid'ed, so the test does not work as intended. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-25* test/ruby/test_process.rb (test_execopts_open_chdir_m17n_path): it's ↵usa
originally for Windows. should not ignore on the platform. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30skip if locale is not UTF-8naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27* test/ruby/test_process.rb (TestProcess#test_execopts_open_chdir_m17n_path):usa
test for r53346, r53347 and r53348. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02* vm_core.h, iseq.h: remove rb_iseq_t::variable_body.ko1
Fields in rb_iseq_t::variable_body are contained by rb_iseq_t::body::mark_ary (hidden Array object). Index 0 to 2 of mark_ary are reserved by these objects. * iseq.c: catch up this fix. * compile.c (rb_iseq_original_iseq): trivial rewrite. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30explicitly overwrite signal handlingnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29revert experimental changes related to Solaris CInaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28increase timeout (with full GC)naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28experimentally add GC.start before spawnnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28write in shroternaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-28suppress warningsnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e