[#44036] [ruby-trunk - Feature #6242][Open] Ruby should support lists — "shugo (Shugo Maeda)" <redmine@...>

20 messages 2012/04/01

[#44084] [ruby-trunk - Bug #6246][Open] 1.9.3-p125 intermittent segfault — "jshow (Jodi Showers)" <jodi@...>

22 messages 2012/04/02

[#44156] [ruby-trunk - Feature #6265][Open] Remove 'useless' 'concatenation' syntax — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

45 messages 2012/04/06

[#44163] [ruby-trunk - Bug #6266][Open] encoding related exception with recent integrated psych — "jonforums (Jon Forums)" <redmine@...>

10 messages 2012/04/06

[#44303] [ruby-trunk - Feature #6284][Open] Add composition for procs — "pabloh (Pablo Herrero)" <pablodherrero@...>

57 messages 2012/04/12

[#44349] [ruby-trunk - Feature #6293][Open] new queue / blocking queues — "tenderlovemaking (Aaron Patterson)" <aaron@...>

10 messages 2012/04/13

[#44402] [ruby-trunk - Feature #6308][Open] Eliminate delegation from WeakRef — "headius (Charles Nutter)" <headius@...>

20 messages 2012/04/17

[#44403] [ruby-trunk - Feature #6309][Open] Add a reference queue for weak references — "headius (Charles Nutter)" <headius@...>

15 messages 2012/04/17

[#44533] [ruby-trunk - Bug #6341][Open] SIGSEGV: Thread.new { fork { GC.start } }.join — "rudolf (r stu3)" <redmine@...>

24 messages 2012/04/22

[#44630] [ruby-trunk - Feature #6361][Open] Bitwise string operations — "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>

31 messages 2012/04/26

[#44648] [ruby-trunk - Feature #6367][Open] #same? for Enumerable — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

16 messages 2012/04/26

[#44704] [ruby-trunk - Feature #6373][Open] public #self — "trans (Thomas Sawyer)" <transfire@...>

61 messages 2012/04/27

[#44748] [ruby-trunk - Feature #6376][Open] Feature lookup and checking if feature is loaded — "trans (Thomas Sawyer)" <transfire@...>

13 messages 2012/04/28

[ruby-core:44383] [ruby-trunk - Bug #6304] JSON.parse with :object_class still causes SEGV

From: "juanje (Juanje Ojeda)" <juanje.ojeda@...>
Date: 2012-04-16 08:03:12 UTC
List: ruby-core #44383
Issue #6304 has been updated by juanje (Juanje Ojeda).


=begin
Sorry, I let the ((*% Done*)) to ((*100*)) and now I can't change it. I did clone the previous bug and I didn't realized that it was set that way :-(
=end

----------------------------------------
Bug #6304: JSON.parse with :object_class still causes SEGV
https://bugs.ruby-lang.org/issues/6304#change-25926

Author: juanje (Juanje Ojeda)
Status: Open
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: ext
Target version: 2.0.0
ruby -v: ruby 1.9.3p184 (2012-04-15 revision 35335) [i686-linux]


=begin
I couldn't reopen the bug #5846 so I created this one, but actually is the same bug which seems to me not fixed.

I got ((|JSON.parse|)) working with some ((|Hash|)) alike classes as ((|Mash|)):

 $ ruby -rjson -rmash -e 'p JSON.parse("{\"key\":\"value\"}", :object_class => Mash)'
 <Mash key="value">


And failing as expected with non ((|Hash|)) alike class as ((|Set|)):

 $ ruby -rjson -rset -e 'p JSON.parse("{\"key\":\"value\"}", :object_class => Set)'
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/common.rb:148:in `parse': undefined method `[]=' for #<Set: {}> (NoMethodError)
 	from /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/common.rb:148:in `parse'
 	from -e:1:in `<main>'


This was behaving like that before.

But when I try with another ((|Hash|)) alike class, ((|Chef::Node|)), is crash as the previous bug says:

 $ ruby -rjson -e 'require "chef/node"; p JSON.parse("{\"key\":\"value\"}", :object_class => Chef::Node)'
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/common.rb:148: [BUG] Segmentation fault
 ruby 1.9.3p184 (2012-04-15 revision 35335) [i686-linux]
 
 -- Control frame information -----------------------------------------------
 c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :parse
 c:0004 p:0031 s:0012 b:0012 l:000011 d:000011 METHOD /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/common.rb:148
 c:0003 p:0043 s:0007 b:0006 l:000e14 d:00163c EVAL   -e:1
 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
 c:0001 p:0000 s:0002 b:0002 l:000e14 d:000e14 TOP   
 
 -- Ruby level backtrace information ----------------------------------------
 -e:1:in `<main>'
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/common.rb:148:in `parse'
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/common.rb:148:in `parse'
 
 -- C level backtrace information -------------------------------------------
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x17f03a) [0xb779603a] vm_dump.c:796
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x52ae3) [0xb7669ae3] error.c:258
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(rb_bug+0x44) [0xb766a804] error.c:277
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x10e76c) [0xb772576c] signal.c:609
 [0xb784e40c]
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(st_lookup+0xe) [0xb772d23e] st.c:326
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(rb_hash_aref+0x3d) [0xb768724d] hash.c:512
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/json/ext/parser.so(+0x252d) [0xb760652d] parser.rl:169
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/json/ext/parser.so(+0x2f59) [0xb7606f59] parser.rl:711
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x16a01d) [0xb778101d] vm_insnhelper.c:320
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x178397) [0xb778f397] vm_insnhelper.c:404
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x16f56f) [0xb778656f] insns.def:1015
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x174533) [0xb778b533] vm.c:1220
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(rb_iseq_eval_main+0xb5) [0xb77912b5] vm.c:1461
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(+0x56854) [0xb766d854] eval.c:204
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(ruby_exec_node+0x24) [0xb766e6c4] eval.c:251
 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/libruby.so.1.9(ruby_run_node+0x36) [0xb7670636] eval.c:244
 ruby() [0x8048658]
 /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0xb74a0113]
 ruby() [0x8048681]
 
 -- Other runtime information -----------------------------------------------
 
 * Loaded script: -e
 
 * Loaded features:
 
     0 enumerator.so
     1 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/enc/encdb.so
     2 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/enc/trans/transdb.so
     3 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
     4 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/rbconfig.rb
     5 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb
     6 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb
     7 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
     8 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems.rb
     9 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/version.rb
    10 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/common.rb
    11 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/enc/utf_16be.so
    12 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/enc/utf_16le.so
    13 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/enc/utf_32be.so
    14 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/enc/utf_32le.so
    15 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/json/ext/parser.so
    16 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/i686-linux/json/ext/generator.so
    17 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json/ext.rb
    18 /home/jojeda/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/json.rb
    ...
   117 /home/jojeda/.rvm/gems/ruby-1.9.3-head/gems/chef-0.10.8/lib/chef/run_list/run_list_expansion.rb
   118 /home/jojeda/.rvm/gems/ruby-1.9.3-head/gems/chef-0.10.8/lib/chef/run_list/versioned_recipe_list.rb
   119 /home/jojeda/.rvm/gems/ruby-1.9.3-head/gems/chef-0.10.8/lib/chef/run_list.rb
   120 /home/jojeda/.rvm/gems/ruby-1.9.3-head/gems/chef-0.10.8/lib/chef/node/attribute.rb
   121 /home/jojeda/.rvm/gems/ruby-1.9.3-head/gems/chef-0.10.8/lib/chef/node.rb
 
 * Process memory map:
 
 08048000-08049000 r-xp 00000000 08:01 5388946    /home/jojeda/.rvm/rubies/ruby-1.9.3-head/bin/ruby
 08049000-0804a000 r--p 00000000 08:01 5388946    /home/jojeda/.rvm/rubies/ruby-1.9.3-head/bin/ruby
 0804a000-0804b000 rw-p 00001000 08:01 5388946    /home/jojeda/.rvm/rubies/ruby-1.9.3-head/bin/ruby
 091c0000-09d9b000 rw-p 00000000 00:00 0          [heap]
 ...
 b784e000-b784f000 r-xp 00000000 00:00 0          [vdso]
 b784f000-b786d000 r-xp 00000000 08:06 263112     /lib/i386-linux-gnu/ld-2.13.so
 b786d000-b786e000 r--p 0001d000 08:06 263112     /lib/i386-linux-gnu/ld-2.13.so
 b786e000-b786f000 rw-p 0001e000 08:06 263112     /lib/i386-linux-gnu/ld-2.13.so
 bfc1b000-bfc3c000 rw-p 00000000 00:00 0          [stack]
 
 
 [NOTE]
 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

I put the full trace at ((<pastebin link|URL:http://pastebin.com/pEwxMij0>)) to avoid the noise.

The ((<Chef::Node|URL:https://github.com/opscode/chef/blob/master/chef/lib/chef/node.rb#L250>)) class implements the methods (({[]})) and (({[]=})). And don't not if they need anything else to be working, but anyways it should fails nicer rather than crash like that, shouldn't it?

Thanks for your time and I hope this help to improve it.


=end



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

In This Thread

Prev Next