[MacRuby] #615: macruby segfaults when generating large random numbers
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: rand bignum -------------------------------+-------------------------------------------- % macruby -e 'rand(2**2048)' unknown: [BUG] Segmentation fault MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64] Since it has to do with random numbers, sometimes it doesn't happen. I can supply a backtrace, but since it is to easy to reproduce, I doubt you need it. Thanks for macruby -- Ticket URL: <http://www.macruby.org/trac/ticket/615> MacRuby <http://macruby.org/>
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: rand bignum -------------------------------+-------------------------------------------- Comment(by lsansonetti@…): We changed random numbers very recently, when did you try this? I was not able to reproduce the crash with today's trunk. -- Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:1> MacRuby <http://macruby.org/>
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: rand bignum -------------------------------+-------------------------------------------- Comment(by ahobson@…): Replying to [comment:1 lsansonetti@…]:
We changed random numbers very recently, when did you try this? I was not able to reproduce the crash with today's trunk.
I originally tried it by rebuilding from source two days ago, but I pulled the latest from git and tried that. {{{ % git show --quiet commit 87110990023d0693189661f8bd8fed3a3b650af2 Author: ernest.prabhakar@gmail.com <ernest.prabhakar@gmail.com@23306eb0-4c56-472 Date: Wed Feb 17 01:47:04 2010 +0000 Explained serial vs. concurrent Queues git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@3562 233 }}} It crashes the same way. I also downloaded the nightly build from 2010-02-16 and I get the same error. I removed /Library/Frameworks/MacRuby.framework before installing the nightly just to make sure my build wasn't messing things up somehow. Below is the Diagnostic log from when I run the command using the nightly build. Is there any other info I can provide? Thanks again. {{{ Process: macruby [53946] Path: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin/macruby Identifier: macruby Version: ??? (???) Code Type: X86-64 (Native) Parent Process: zsh [1266] Date/Time: 2010-02-16 21:29:15.888 -0500 OS Version: Mac OS X 10.6.2 (10C540) Report Version: 6 Exception Type: EXC_BAD_ACCESS (SIGABRT) Exception Codes: KERN_INVALID_ADDRESS at 0xffffffffcea54ec3 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: objc[53946]: garbage collection is ON abort() called Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x00007fff820f2fe6 __kill + 10 1 libSystem.B.dylib 0x00007fff82193e32 abort + 83 2 libmacruby.dylib 0x000000010004429d rb_bug + 205 3 libmacruby.dylib 0x00000001000eadf0 sigbus + 0 4 libSystem.B.dylib 0x00007fff82104eaa _sigtramp + 26 5 ??? 0x00007fff5fbfeb60 0 + 140734799801184 6 libauto.dylib 0x00007fff82514488 Auto::Zone::block_allocate(Auto::Thread&, unsigned long, unsigned int, bool, bool) + 1048 7 libauto.dylib 0x00007fff825041f3 auto_realloc(_malloc_zone_t*, void*, unsigned long) + 851 8 libSystem.B.dylib 0x00007fff820acb3b malloc_zone_realloc + 92 9 libmacruby.dylib 0x00000001000534da ruby_xrealloc + 42 10 libmacruby.dylib 0x00000001000271fc rb_big_realloc + 172 11 libmacruby.dylib 0x000000010002aca1 bignorm + 369 12 libmacruby.dylib 0x00000001000b1f38 rb_f_rand + 120 13 libmacruby.dylib 0x0000000100174852 rb_vm_dispatch + 6098 14 ??? 0x000000010104009e 0 + 4312006814 15 libmacruby.dylib 0x0000000100183f9f rb_vm_run + 351 16 libmacruby.dylib 0x00000001000464d9 ruby_run_node + 73 17 macruby 0x0000000100000d28 main + 152 18 macruby 0x0000000100000c88 start + 52 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:2> MacRuby <http://macruby.org/>
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: rand bignum -------------------------------+-------------------------------------------- Comment(by ahobson@…): I just noticed that assigning to a variable seems to affect the behavior if I generate a smaller number. {{{ # notice no crash! % macruby -e 'x=rand(2**1024)' # but this does crash % macruby -e 'x=rand(2**1024);puts x' unknown: [BUG] Segmentation fault MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64] zsh: abort macruby -e 'x=rand(2**1024);puts x' # maybe we just got lucky before? % macruby -e 'x=rand(2**1024)' % macruby -e 'x=rand(2**1024)' % macruby -e 'x=rand(2**1024)' # doesn't seem like it. But generating a larger random number always seems to crash % macruby -e 'x=rand(2**2048)' unknown: [BUG] Segmentation fault MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64] zsh: abort macruby -e 'x=rand(2**2048)' % macruby -e 'x=rand(2**2048)' unknown: [BUG] Segmentation fault MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64] zsh: abort macruby -e 'x=rand(2**2048)' # hmm, where does the problem seem to occur between 1024 and 2048? # 2**1472 seems to be reliably ok % macruby -e 'x=rand(2**1472)' % macruby -e 'x=rand(2**1472)' % macruby -e 'x=rand(2**1472)' # but 2**1473 seems to reliably crash % macruby -e 'x=rand(2**1473)' unknown: [BUG] Segmentation fault MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64] zsh: abort macruby -e 'x=rand(2**1473)' }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:3> MacRuby <http://macruby.org/>
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: rand bignum -------------------------------+-------------------------------------------- Comment(by lsansonetti@…): I can reproduce a crash with {{{while true; rand(2**1000); end}}}. Looks like a bignum problem. -- Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:4> MacRuby <http://macruby.org/>
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: Component: MacRuby | Resolution: fixed Keywords: rand bignum | -------------------------------+-------------------------------------------- Changes (by pthomson@…): * status: new => closed * resolution: => fixed Comment: Fixed in r3806. -- Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:5> MacRuby <http://macruby.org/>
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: reopened Priority: major | Milestone: Component: MacRuby | Resolution: Keywords: rand bignum | -------------------------------+-------------------------------------------- Changes (by lsansonetti@…): * status: closed => reopened * resolution: fixed => Comment: I reverted r3806 because it's bad, it does not copy previous content, so it breaks a lot of specs. Also, it looks like this realloc function should really work, so the problem is surely elsewhere. (Please test before committing next time :-)). -- Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:6> MacRuby <http://macruby.org/>
#615: macruby segfaults when generating large random numbers -------------------------------+-------------------------------------------- Reporter: ahobson@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.6 Component: MacRuby | Resolution: fixed Keywords: rand bignum | -------------------------------+-------------------------------------------- Changes (by lsansonetti@…): * status: reopened => closed * resolution: => fixed * milestone: => MacRuby 0.6 Comment: This has been fixed since r3831. -- Ticket URL: <http://www.macruby.org/trac/ticket/615#comment:7> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby