Issue #4765 has been reported by Motohiro KOSAKI.

----------------------------------------
Bug #4765: signal ???罩c?????????鴻???????????????? main thread ??с?激?違???????潟???????????????????
http://redmine.ruby-lang.org/issues/4765

Author: Motohiro KOSAKI
Status: Assigned
Priority: Normal
Assignee: Motohiro KOSAKI
Category: core
Target version: 1.9.x
ruby -v: ruby 1.9.3dev (2011-05-21 trunk 31654) [x86_64-linux]


Bug#4027 ??????羇丞??????????障??

> ???????????<?ゃ?潟?鴻???????????????? Thread ??絲上?????????鴻?????????激?違????????鴻??? SIGSEGV ??? SIGVTALRM ????
> 紊?????????????????????????????????????????障????????
> ?????????? sighandler() ?????帥?ゃ????若?鴻????????с????<?ゃ?潟?鴻????????у??茵?????????????障?????
> ????????篁ヤ?????????????????с???????????障?????
>  * init_sigchld ??у???????倶??(腥冴????鴻??)??? sigmask ??? trap_last_sigmask ????絖??????????
>  * ??帥?ゃ????若?鴻????????莎???(rb_thread_create_timer_thread)??с?<?ゃ?潟?鴻????????????鴻?????祉??????????????
>  * ????????????<?ゃ???若??筝???紊????????????????????????? rb_trap_restore_mask() ?????若?違????? trap_last_sigmask ???
>    篆?絖??????????腥冴????鴻?????祉??????????????????????激?違????????鴻???紊???????
>
> ??障?????Signal.trap ??с???潟????????祉????????????????????????激?違??????激?違????????鴻???紊?????????????障?????
> sigaction ?????????激?違???????潟???????茵????帥?ゃ????若?鴻?????????障????????????????????с?????????荀?????????????障?????
> ??障??箴?紊???榊???????? rb_trap_restore_mask ???茯????с????????????trap() ??т??紊??????榊????????? trap_ensure() ???
> ??激?違????????鴻?????祉??????????????????????????т??荀????????????????????障??????????????????????????宴?у?若?違?????????????
> ??????????????c?????ц?篆??????с?????????

??????ャ?若?????腟???????rb_trap_restore_mask()?????障?c?????荀??????????????????????????障?????

> ??????????????ф兄篁?????????????????????篏??????????帥?障????????
> 
> ???????????????????綵???????? make test-all ??? Failure ??? 2??ゅ???????障?????
> ???????????? ruby ???????祉?鴻????激?違?????ф?????????????篋???鴻????若?帥?鴻?? $?.signaled? == true ??с???
> $?.exited? == true ?????????????с?????
> ?????????????眼????違???????????????????障????????
>
>  1) Failure:
> test_should_propagate_signaled(TestBeginEndBlock) [/Users/nagachika/opt/ruby-trunk/src/ruby-trunk/test/ruby/test_beginendblock.rb:108]:
> Expected 0 to be nil.
>
>  2) Failure:
> test_status_kill(TestProcess) [/Users/nagachika/opt/ruby-trunk/src/ruby-trunk/test/ruby/test_process.rb:1073]:
> [s.exited?, s.signaled?, s.stopped?].
> <[false, true, false]> expected but was
> <[true, false, false]>.

????????? rb_syswait()?????????障???????? Process.wait()筝?? ??????? SIGHUP, SIGQUIT, SIGINT??? SIG_IGN??荐絎??????????障????????
??????????ャ?鴻????????? SIGQUIT?????????????????????鴻????罩?????????????障????????
???????????????signal handler???????祉?鴻?違??若???????с??????????筝?т??????????? SIG_IGN??????????????障????????篁????鴻?????????
菴傑???????障?????pthread_sigmask()??綏?????帥????????????罎?荐????????с??????????????????????激?違????????帥?ゃ????若?鴻?????????????????????????????
???????荐?????莢???????????????????????????綽?荀????????????腟?茫????????障????????

??障?ゃ????????????????????????茖????障?ゃ?????????????????????????障?????10綛岩札筝????????х?∞????????????????障???????????荀??????????????
SIG_IGN???荐?????????????????宴???????????????????????


> ??障?????sighandler() ?????<?ゃ?潟?鴻??????????????若?違????????? Process.spawn ???絎?茵??????????障??????????????障????障?????
> process.c ??? before_fork/after_fork ??? fork ?????????????????帥?ゃ????若?鴻?????????罩≪?????激?違????????鴻???紊????????????с?????
> ?????<????????????????????????????????????????с?????
> fork ??????????障?上?????膓?????????????????????????????????????????????????????????障????????spawn ?????????????
> fork 緇???? sigprogmask ??у??????????????????????с?????????????????????с??????????????
> ?????若?с????帥?ゃ????若?鴻??????????莎桁????х??絮?筝????????????????????障????障???????

????????????筝??????????激?違????????鴻???筝?????????????????????????筝?荀?????????????障?????


??障???????吟??chikanaga?????????怨???????????????????????倶??????????????????????激?違????????????眼?????
test_signal.rb#test_kill_immediately_before_termination ??с????鴻?????????潟?違????障?????
????????????????????????鴻?????絖???????祉?鴻??SIGINT?????c?????冴???????????箴?紊????腆肴???????????????с????????
test/unit/parallel.rb#run() ??? Signal.trap(:INT,"IGNORE") ???????罐究??????????????????????
?????鴻?????SIGINT????????????????篁?罕?紊???眼???????c?????茵?????????????????????с?????

sora?????????????????????潟??????с?????鐚?篁f?炊??????????????綽?荀???????????????????障?????????????????????
絖???????祉?鴻??????????荐??????????c?????茵???????荐怨鴻?с???????????????障??????????鴻????????????冴?????
膃?? Ctrl-C ?????????????鴻???????? test-all ?????????????ゃ??ゃ?????障?????


??ゃ????с?篁ヤ???????眼??茵??????障?????
???SIGPIPE?????潟??????腥咲?∽?違?????SIG_IGN??????眼??腥咲?∽?違??????????????????????若?句??????
  ?????????祉??????????♂????????????????????c?????????????ruby??筝???EPIPE???????潟?????潟?違?????????贋???????
??糸???????緇???с??ruby_default_signal() ??с?激?違???????潟??????SIG_DFL???祉?????????膊???????
  ??激?違????????鴻???茹i?ゃ???????????紊????

羞私??????????????? test-all ??????????????????腆肴????堺?ャ?????障?????

????????????≪?潟?????????????????1.9.4????????????????c?????障??????????宴??
??祉??????????眼?????????翫?順?????倶???????????????? bug report ?????????
??脂?桁拘??丞舟?????????????????????с???????с?????亥??????????障??????????絖?????????潟?若?????荀???ゃ????c??????
  絎?絎?????????????????????????醇?с????????

????????????????????



-- 
http://redmine.ruby-lang.org