ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:46174] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
@ 2012-09-29  9:27 mrkn (Kenta Murata)
  2012-09-29  9:29 ` [ruby-dev:46175] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: mrkn (Kenta Murata) @ 2012-09-29  9:27 UTC (permalink / raw
  To: ruby developers list


Issue #7084 has been reported by mrkn (Kenta Murata).

----------------------------------------
Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://bugs.ruby-lang.org/issues/7084

Author: mrkn (Kenta Murata)
Status: Open
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]


以下のように ulimit -s の値に応じて stack level too deep と Segmentation Fault のどちらかが発生するようです。

$ .prefix/bin/ruby -v
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]
$ ulimit -s
8192
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: stack level too deep (SystemStackError)
$ ulimit -s 32768
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: [BUG] Segmentation fault
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0009 e:000008 CFUNC  :compile
c:0002 p:0028 s:0005 e:000bc8 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0002 e:0020e8 TOP    [FINISH]

-e:1:in `<main>'
-e:1:in `compile'

-- C level backtrace information -------------------------------------------

   See Crash Report log file under ~/Library/Logs/CrashReporter or
   /Library/Logs/CrashReporter, for the more detail of.

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:46175] [ruby-trunk - Bug #7084] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
  2012-09-29  9:27 [ruby-dev:46174] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault mrkn (Kenta Murata)
@ 2012-09-29  9:29 ` mrkn (Kenta Murata)
  2012-09-29 10:39 ` [ruby-dev:46176] Re: [ruby-trunk - Bug #7084][Open] " SASADA Koichi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: mrkn (Kenta Murata) @ 2012-09-29  9:29 UTC (permalink / raw
  To: ruby developers list


Issue #7084 has been updated by mrkn (Kenta Murata).


gdb で採取したバックとレースを gist に上げました。ulimit -s 8192 の場合です。参考までに。
https://gist.github.com/3803540

----------------------------------------
Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://bugs.ruby-lang.org/issues/7084#change-29781

Author: mrkn (Kenta Murata)
Status: Open
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]


以下のように ulimit -s の値に応じて stack level too deep と Segmentation Fault のどちらかが発生するようです。

$ .prefix/bin/ruby -v
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]
$ ulimit -s
8192
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: stack level too deep (SystemStackError)
$ ulimit -s 32768
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: [BUG] Segmentation fault
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0009 e:000008 CFUNC  :compile
c:0002 p:0028 s:0005 e:000bc8 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0002 e:0020e8 TOP    [FINISH]

-e:1:in `<main>'
-e:1:in `compile'

-- C level backtrace information -------------------------------------------

   See Crash Report log file under ~/Library/Logs/CrashReporter or
   /Library/Logs/CrashReporter, for the more detail of.

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:46176] Re: [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
  2012-09-29  9:27 [ruby-dev:46174] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault mrkn (Kenta Murata)
  2012-09-29  9:29 ` [ruby-dev:46175] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
@ 2012-09-29 10:39 ` SASADA Koichi
  2012-09-29 14:11 ` [ruby-dev:46177] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: SASADA Koichi @ 2012-09-29 10:39 UTC (permalink / raw
  To: ruby developers list

(2012/09/29 18:27), mrkn (Kenta Murata) wrote:
> 以下のように ulimit -s の値に応じて stack level too deep と Segmentation Fault のどちらかが発生するようです。

 ええと,どうしたもんですかね.実装の都合でスタックオーバーフローするも
のは他にもありそうなので,これだけ頑張るべきか,よくわからないんですが....

 これだけ取り出した理由はなんでしょうか.こういう操作ってよくやるんです
かね.

-- 
// SASADA Koichi at atdot dot net

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:46177] [ruby-trunk - Bug #7084] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
  2012-09-29  9:27 [ruby-dev:46174] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault mrkn (Kenta Murata)
  2012-09-29  9:29 ` [ruby-dev:46175] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
  2012-09-29 10:39 ` [ruby-dev:46176] Re: [ruby-trunk - Bug #7084][Open] " SASADA Koichi
@ 2012-09-29 14:11 ` mrkn (Kenta Murata)
  2012-09-30 11:19   ` [ruby-dev:46178] " SASADA Koichi
  2012-10-03  9:38 ` [ruby-dev:46198] " ko1 (Koichi Sasada)
  2012-10-03 17:22 ` [ruby-dev:46199] [ruby-trunk - Bug #7084][Open] " mrkn (Kenta Murata)
  4 siblings, 1 reply; 7+ messages in thread
From: mrkn (Kenta Murata) @ 2012-09-29 14:11 UTC (permalink / raw
  To: ruby developers list


Issue #7084 has been updated by mrkn (Kenta Murata).


"1+"*10000 + "1" は YAPC::Asia の LT で見かけたネタです。

ulimit -s の値に依存して SEGV してしまう場合があるので、それだけでも直したいです。
----------------------------------------
Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://bugs.ruby-lang.org/issues/7084#change-29789

Author: mrkn (Kenta Murata)
Status: Open
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]


以下のように ulimit -s の値に応じて stack level too deep と Segmentation Fault のどちらかが発生するようです。

$ .prefix/bin/ruby -v
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]
$ ulimit -s
8192
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: stack level too deep (SystemStackError)
$ ulimit -s 32768
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: [BUG] Segmentation fault
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0009 e:000008 CFUNC  :compile
c:0002 p:0028 s:0005 e:000bc8 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0002 e:0020e8 TOP    [FINISH]

-e:1:in `<main>'
-e:1:in `compile'

-- C level backtrace information -------------------------------------------

   See Crash Report log file under ~/Library/Logs/CrashReporter or
   /Library/Logs/CrashReporter, for the more detail of.

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:46178] Re: [ruby-trunk - Bug #7084] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
  2012-09-29 14:11 ` [ruby-dev:46177] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
@ 2012-09-30 11:19   ` SASADA Koichi
  0 siblings, 0 replies; 7+ messages in thread
From: SASADA Koichi @ 2012-09-30 11:19 UTC (permalink / raw
  To: ruby developers list

(2012/09/29 23:11), mrkn (Kenta Murata) wrote:
> 
> ulimit -s の値に依存して SEGV してしまう場合があるので、それだけでも直したいです。

 ulimit -s の値に依存せず SEGV するのはもっと嫌な気がしますが,それはと
もかく,直るのなら大変結構なことだと思います.よろしくお願いします.

-- 
// SASADA Koichi at atdot dot net

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:46198] [ruby-trunk - Bug #7084] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
  2012-09-29  9:27 [ruby-dev:46174] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault mrkn (Kenta Murata)
                   ` (2 preceding siblings ...)
  2012-09-29 14:11 ` [ruby-dev:46177] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
@ 2012-10-03  9:38 ` ko1 (Koichi Sasada)
  2012-10-03 17:22 ` [ruby-dev:46199] [ruby-trunk - Bug #7084][Open] " mrkn (Kenta Murata)
  4 siblings, 0 replies; 7+ messages in thread
From: ko1 (Koichi Sasada) @ 2012-10-03  9:38 UTC (permalink / raw
  To: ruby developers list


Issue #7084 has been updated by ko1 (Koichi Sasada).


これって,r37072 で直ったんでしょうか.

----------------------------------------
Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://bugs.ruby-lang.org/issues/7084#change-29980

Author: mrkn (Kenta Murata)
Status: Closed
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]


以下のように ulimit -s の値に応じて stack level too deep と Segmentation Fault のどちらかが発生するようです。

$ .prefix/bin/ruby -v
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]
$ ulimit -s
8192
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: stack level too deep (SystemStackError)
$ ulimit -s 32768
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: [BUG] Segmentation fault
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0009 e:000008 CFUNC  :compile
c:0002 p:0028 s:0005 e:000bc8 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0002 e:0020e8 TOP    [FINISH]

-e:1:in `<main>'
-e:1:in `compile'

-- C level backtrace information -------------------------------------------

   See Crash Report log file under ~/Library/Logs/CrashReporter or
   /Library/Logs/CrashReporter, for the more detail of.

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-dev:46199] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
  2012-09-29  9:27 [ruby-dev:46174] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault mrkn (Kenta Murata)
                   ` (3 preceding siblings ...)
  2012-10-03  9:38 ` [ruby-dev:46198] " ko1 (Koichi Sasada)
@ 2012-10-03 17:22 ` mrkn (Kenta Murata)
  4 siblings, 0 replies; 7+ messages in thread
From: mrkn (Kenta Murata) @ 2012-10-03 17:22 UTC (permalink / raw
  To: ruby developers list


Issue #7084 has been updated by mrkn (Kenta Murata).

Status changed from Closed to Open

まだ直ってません。ulimit -s 32768 の場合はきちんと SystemStackError で終了しましたが、
ulimit -s 4096 の場合に Segmentation Fault が発生しています。

さっき追加で調査した結果を以下に述べます。
https://gist.github.com/3828296
この gist に貼った 1.patch を当てて問題をコードを実行すると、
1.log として貼付けたように iseq_compile_each のローカル変数 type のアドレスがずらずら表示されます。

前後に隣り合うアドレスの差分を計算すると、再帰呼び出し1段で type のアドレスが6928も変化していてページサイズより大きいため、
ruby_stack_overflowed_p でスタックオーバーフローの判定に失敗しているのかなぁと推測しました。

そこで、iseq_compile_each の中の switch 文を複数の関数に分離して実行してみました。
https://gist.github.com/3828416

iseq_compile_each が使うスタックのサイズは560まで減りましたが、依然としてスタックオーバーフローの判定に失敗してます。

ここまでやって力尽きたので、また日を改めて調査します。
----------------------------------------
Bug #7084: RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault
https://bugs.ruby-lang.org/issues/7084#change-29995

Author: mrkn (Kenta Murata)
Status: Open
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]


以下のように ulimit -s の値に応じて stack level too deep と Segmentation Fault のどちらかが発生するようです。

$ .prefix/bin/ruby -v
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]
$ ulimit -s
8192
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: stack level too deep (SystemStackError)
$ ulimit -s 32768
$ .prefix/bin/ruby -e 'p RubyVM::InstructionSequence.compile("1+"*10000+"1")'
-e:1: [BUG] Segmentation fault
ruby 2.0.0dev (2012-09-29 trunk 37053) [x86_64-darwin12.1.0]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0009 e:000008 CFUNC  :compile
c:0002 p:0028 s:0005 e:000bc8 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0002 e:0020e8 TOP    [FINISH]

-e:1:in `<main>'
-e:1:in `compile'

-- C level backtrace information -------------------------------------------

   See Crash Report log file under ~/Library/Logs/CrashReporter or
   /Library/Logs/CrashReporter, for the more detail of.

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-03 17:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-29  9:27 [ruby-dev:46174] [ruby-trunk - Bug #7084][Open] RubyVM::InstructionSequence.compile("1+"*10000 + "1") causes SystemStackError or Segmentation Fault mrkn (Kenta Murata)
2012-09-29  9:29 ` [ruby-dev:46175] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
2012-09-29 10:39 ` [ruby-dev:46176] Re: [ruby-trunk - Bug #7084][Open] " SASADA Koichi
2012-09-29 14:11 ` [ruby-dev:46177] [ruby-trunk - Bug #7084] " mrkn (Kenta Murata)
2012-09-30 11:19   ` [ruby-dev:46178] " SASADA Koichi
2012-10-03  9:38 ` [ruby-dev:46198] " ko1 (Koichi Sasada)
2012-10-03 17:22 ` [ruby-dev:46199] [ruby-trunk - Bug #7084][Open] " mrkn (Kenta Murata)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).