Problem with case/when menus in ruby 2.5.0dev (2017-10-25) [x86_64-linux] - semi-random tracebook of different errors (NODE_STR, NODE_ARGS etc...) and also segfaults sometimes
I think something must have changed in ruby recently in regards to how
case/when menus are handled. I am using svn checkout of ruby today.
I can trigger strange bug events that appear to be semi-random:
/Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb: /Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb:2848: NODE_CASE: unknown node (NODE_OP_CDECL) (SyntaxError
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
/Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb: /Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb:171: iseq_compile_each: unknown node (NODE_ARGS_AUX) (SyntaxError)
/Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb: /Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb: NODE_CASE: unknown node (NODE_SCOPE) (SyntaxError)
/Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb: /Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb:6084: NODE_CASE: unknown node (NODE_STR) (SyntaxError)
/Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb: /Programs/Ruby/25.10.2017/lib/ruby/site_ruby/2.5.0/beautiful_url/menu.rb:2849: iseq_compile_each: unknown node (NODE_ARGS) (SyntaxError)
The above errors appear to happen randomly. I should note that this is
a really HUGE case/when menu. I even split it up into separate .rb files
because I used to get "out of memory" errors with ruby. :D
With the stable "ruby 2.4.2p198" I do not get the above, semi-random
errors, so I am quite sure that something may have changed since then.
I removed the gem "beautiful_url" for the time being, until I have
finished reworking it; then I will upload it again.
Before the above errors, I also had some more specific errors about
specific lines that appeared to be "wrong" to ruby 2.5.x - but ruby
2.4.x was fine with that.
The most confusing part is that I can randomly "trigger" different
results, upon invoking the above. Sometimes I just get a plain
SEGFAULT, and sometimes I seem to randomly get NODE_OP_CDECL or
NODE_ARGS_AUX or NODE_SCOPE or NODE_STR or NODE_ARGS. I have never
seen that behaviour before. :)
I am sorry to be unable to give more information right now. I will
continue to investigate but most time I spend with ruby 2.4.2 and
perhaps the above error may disappear in a while. (May be due to
errors in my own .rb files, but since ruby 2.4.2 does not exhibit
the above issue, I think it must be because something may have
changed in ruby 2.5.x).
I'll try to make this more reproducable if it keeps on appearing
in later svn-checkouts in some days / a few weeks perhaps. I test
upcoming ruby semi-regularly.
Updated by shevegen (Robert A. Heiler) over 2 years ago
Come to think about it, while it may not be directly related to the
above report, I think it may also have to do with the fact that the
case/when menu is really huge, using lots of conditional checks
case i when /^Foo(_|-| )?bar(_|-| )?bla(_|-| )?$/i 'some_remote_url_here'
I don't recommend anyone to use such huge case/when menus but now I
consider it just ... testing ruby a little bit as well. :D
I think that either way, perhaps the error message could be different -
or perhaps more consistent to itself IF this bug is related to
memory problems, such as the "out of memory" errors. However had, I
speculate here since I do not know the origin. All I suspect is that
it may have to do with excessively long case/when menus and way
too many regex-entries in them. :)