https://redmine.ruby-lang.org/
https://redmine.ruby-lang.org/favicon.ico?1709775478
2012-09-29T18:29:01Z
Ruby Issue Tracking System
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=29781
2012-09-29T18:29:01Z
mrkn (Kenta Murata)
muraken@gmail.com
<ul></ul><p>gdb で採取したバックとレースを gist に上げました。ulimit -s 8192 の場合です。参考までに。<br>
<a href="https://gist.github.com/3803540" class="external">https://gist.github.com/3803540</a></p>
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=29784
2012-09-29T19:53:11Z
ko1 (Koichi Sasada)
<ul></ul><p>(2012/09/29 18:27), mrkn (Kenta Murata) wrote:</p>
<blockquote>
<p>以下のように ulimit -s の値に応じて stack level too deep と Segmentation Fault のどちらかが発生するようです。</p>
</blockquote>
<p> ええと,どうしたもんですかね.実装の都合でスタックオーバーフローするも<br>
のは他にもありそうなので,これだけ頑張るべきか,よくわからないんですが....</p>
<p> これだけ取り出した理由はなんでしょうか.こういう操作ってよくやるんです<br>
かね.</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p>
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=29789
2012-09-29T23:11:56Z
mrkn (Kenta Murata)
muraken@gmail.com
<ul></ul><p>"1+"*10000 + "1" は YAPC::Asia の LT で見かけたネタです。</p>
<p>ulimit -s の値に依存して SEGV してしまう場合があるので、それだけでも直したいです。</p>
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=29806
2012-09-30T20:23:21Z
ko1 (Koichi Sasada)
<ul></ul><p>(2012/09/29 23:11), mrkn (Kenta Murata) wrote:</p>
<blockquote>
<p>ulimit -s の値に依存して SEGV してしまう場合があるので、それだけでも直したいです。</p>
</blockquote>
<p> ulimit -s の値に依存せず SEGV するのはもっと嫌な気がしますが,それはと<br>
もかく,直るのなら大変結構なことだと思います.よろしくお願いします.</p>
<p>--<br>
// SASADA Koichi at atdot dot net</p>
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=29962
2012-10-03T15:33:15Z
nobu (Nobuyoshi Nakada)
nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r37072.<br>
Kenta, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>thread_pthread.c: init stack with ulimit</p>
<ul>
<li>thread_pthread.c (ruby_init_stack): use getrlimit() for the main<br>
thread on Mac OS X, since pthread_get_stack{addr,size}_np() and<br>
return the default value always, but not the ulimit value.<br>
<a href="/issues/7084">[ruby-dev:46174]</a> [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault (Closed)" href="https://redmine.ruby-lang.org/issues/7084">#7084</a>]</li>
</ul>
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=29980
2012-10-03T18:38:19Z
ko1 (Koichi Sasada)
<ul></ul><p>これって,r37072 で直ったんでしょうか.</p>
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=29995
2012-10-04T02:22:45Z
mrkn (Kenta Murata)
muraken@gmail.com
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul><p>まだ直ってません。ulimit -s 32768 の場合はきちんと SystemStackError で終了しましたが、<br>
ulimit -s 4096 の場合に Segmentation Fault が発生しています。</p>
<p>さっき追加で調査した結果を以下に述べます。<br>
<a href="https://gist.github.com/3828296" class="external">https://gist.github.com/3828296</a><br>
この gist に貼った 1.patch を当てて問題をコードを実行すると、<br>
1.log として貼付けたように iseq_compile_each のローカル変数 type のアドレスがずらずら表示されます。</p>
<p>前後に隣り合うアドレスの差分を計算すると、再帰呼び出し1段で type のアドレスが6928も変化していてページサイズより大きいため、<br>
ruby_stack_overflowed_p でスタックオーバーフローの判定に失敗しているのかなぁと推測しました。</p>
<p>そこで、iseq_compile_each の中の switch 文を複数の関数に分離して実行してみました。<br>
<a href="https://gist.github.com/3828416" class="external">https://gist.github.com/3828416</a></p>
<p>iseq_compile_each が使うスタックのサイズは560まで減りましたが、依然としてスタックオーバーフローの判定に失敗してます。</p>
<p>ここまでやって力尽きたので、また日を改めて調査します。</p>
Ruby master - Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://redmine.ruby-lang.org/issues/7084?journal_id=30018
2012-10-04T11:43:35Z
nobu (Nobuyoshi Nakada)
nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>This issue was solved with changeset r37080.<br>
Kenta, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>thread_pthread.c: precise stack size</p>
<ul>
<li>thread_pthread.c (ruby_init_stack): round stack limit to page size<br>
boundary to calculate stack size more precisely. <a href="/issues/7084">[ruby-dev:46174]</a><br>
[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault (Closed)" href="https://redmine.ruby-lang.org/issues/7084">#7084</a>]</li>
</ul>