Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rake task using 'json' crashes on Mac OS X

Tags:

ruby

rake

rvm

Following rakefile will crash ruby:

require 'json'

task :default do |t, p|
end

Running rake will get:

$ rake

/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   the more detail of.

-- Control frame information -----------------------------------------------
c:0026 p:-17548726946152 s:0099 e:000098 TOP    [FINISH]
c:0025 p:---- s:0097 e:000096 CFUNC  :require
c:0024 p:0115 s:0093 e:000092 METHOD /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55
c:0023 p:0009 s:0083 e:000082 CLASS  /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext.rb:13
c:0022 p:0011 s:0081 e:000080 CLASS  /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext.rb:12
c:0021 p:0057 s:0079 e:000078 TOP    /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext.rb:9 [FINISH]
c:0020 p:---- s:0077 e:000076 CFUNC  :require
c:0019 p:0115 s:0073 e:000072 METHOD /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55
c:0018 p:0019 s:0063 e:000062 CLASS  /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json.rb:58
c:0017 p:0017 s:0061 e:000060 TOP    /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json.rb:54 [FINISH]
c:0016 p:---- s:0059 e:000058 CFUNC  :require
c:0015 p:0115 s:0055 e:000054 METHOD /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55
c:0014 p:0007 s:0045 e:000044 TOP    /Users/mobile/test.rake:1 [FINISH]
c:0013 p:---- s:0043 e:000042 CFUNC  :load
c:0012 p:0009 s:0039 e:000038 METHOD /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/rake_module.rb:28
c:0011 p:0176 s:0035 e:000034 METHOD /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:689
c:0010 p:0007 s:0030 e:000029 BLOCK  /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:94
c:0009 p:0006 s:0028 e:000027 METHOD /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:176
c:0008 p:0007 s:0024 e:000023 METHOD /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:93
c:0007 p:0013 s:0021 e:000020 BLOCK  /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:77
c:0006 p:0006 s:0019 e:000018 METHOD /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:176
c:0005 p:0007 s:0015 e:000014 METHOD /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:75
c:0004 p:0040 s:0012 e:000011 TOP    /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/bin/rake:33 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC  :load
c:0002 p:0118 s:0006 E:001b38 EVAL   /Users/mobile/.rvm/gems/ruby-2.0.0-p594/bin/rake:23 [FINISH]
c:0001 p:0000 s:0002 E:001688 TOP    [FINISH]

/Users/mobile/.rvm/gems/ruby-2.0.0-p594/bin/rake:23:in `<main>'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/bin/rake:23:in `load'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/Users/mobile/test.rake:1:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json.rb:54:in `<top (required)>'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json.rb:58:in `<module:JSON>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext.rb:9:in `<top (required)>'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext.rb:12:in `<module:JSON>'
/Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/ext.rb:13:in `<module:Ext>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'

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

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

* Loaded script: /Users/mobile/.rvm/gems/ruby-2.0.0-p594/bin/rake

* Loaded features:

    0 enumerator.so
    1 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/enc/encdb.bundle
    2 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/enc/trans/transdb.bundle
    3 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/rbconfig.rb
    4 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/compatibility.rb
    5 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/defaults.rb
    6 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/deprecate.rb
    7 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/errors.rb
    8 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/version.rb
    9 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/requirement.rb
   10 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/platform.rb
   11 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb
   12 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/exceptions.rb
   13 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb
   14 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/thread.rb
   15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/monitor.rb
   16 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb
   17 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb
   18 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb
   19 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/path_support.rb
   20 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/version.rb
   21 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/etc.bundle
   22 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb
   23 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/singleton.rb
   24 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/optparse.rb
   25 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/ostruct.rb
   26 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/ext/module.rb
   27 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/ext/core.rb
   28 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/ext/string.rb
   29 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/early_time.rb
   30 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/late_time.rb
   31 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/ext/time.rb
   32 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/alt_system.rb
   33 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/win32.rb
   34 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/linked_list.rb
   35 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open3.rb
   36 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/cpu_counter.rb
   37 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/scope.rb
   38 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/task_argument_error.rb
   39 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/rule_recursion_overflow_error.rb
   40 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/shellwords.rb
   41 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/task_manager.rb
   42 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/cloneable.rb
   43 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/file_utils.rb
   44 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/file_utils_ext.rb
   45 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/pathmap.rb
   46 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/file_list.rb
   47 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb
   48 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/promise.rb
   49 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/thread_pool.rb
   50 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/private_reader.rb
   51 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/thread_history_display.rb
   52 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/trace_output.rb
   53 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/application.rb
   54 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/rake_module.rb
   55 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/pseudo_status.rb
   56 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/task_arguments.rb
   57 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/invocation_chain.rb
   58 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/invocation_exception_mixin.rb
   59 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/task.rb
   60 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/file_task.rb
   61 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/file_creation_task.rb
   62 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/multi_task.rb
   63 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/dsl_definition.rb
   64 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/default_loader.rb
   65 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/name_space.rb
   66 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake/backtrace.rb
   67 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/rake-10.4.2/lib/rake.rb
   68 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/version.rb
   69 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/generic_object.rb
   70 /Users/mobile/.rvm/gems/ruby-2.0.0-p594/gems/json-1.8.3/lib/json/common.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
Don't forget to include the above Crash Report log file.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

While running the following in irb is fine:

$ irb
2.0.0-p594 :001 > require 'json'
 => true 

Here's the output from rvm info:

$ rvm info

ruby-2.0.0-p594:

  system:
    uname:       "Darwin mobile.private 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64"
    system:      "osx/10.11/x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)"
    zsh:         "/bin/zsh => zsh 5.0.8 (x86_64-apple-darwin15.0)"

  rvm:
    version:      "rvm 1.26.11 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
    updated:      "45 minutes 37 seconds ago"
    path:         "/Users/mobile/.rvm"

  ruby:
    interpreter:  "ruby"
    version:      "2.0.0p594"
    date:         "2014-10-27"
    platform:     "x86_64-darwin14.0.0"
    patchlevel:   "2014-10-27 revision 48167"
    full_version: "ruby 2.0.0p594 (2014-10-27 revision 48167) [x86_64-darwin14.0.0]"

  homes:
    gem:          "/Users/mobile/.rvm/gems/ruby-2.0.0-p594"
    ruby:         "/Users/mobile/.rvm/rubies/ruby-2.0.0-p594"

  binaries:
    ruby:         "/Users/mobile/.rvm/rubies/ruby-2.0.0-p594/bin/ruby"
    irb:          "/Users/mobile/.rvm/rubies/ruby-2.0.0-p594/bin/irb"
    gem:          "/Users/mobile/.rvm/rubies/ruby-2.0.0-p594/bin/gem"
    rake:         "/Users/mobile/.rvm/gems/ruby-2.0.0-p594/bin/rake"

  environment:
    PATH:         "/Users/mobile/.rvm/gems/ruby-2.0.0-p594/bin:/Users/mobile/.rvm/gems/ruby-2.0.0-p594@global/bin:/Users/mobile/.rvm/rubies/ruby-2.0.0-p594/bin:/Users/mobile/.rvm/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Server.app/Contents/ServerRoot/usr/bin:/Applications/Server.app/Contents/ServerRoot/usr/sbin:/usr/local/sbin"
    GEM_HOME:     "/Users/mobile/.rvm/gems/ruby-2.0.0-p594"
    GEM_PATH:     "/Users/mobile/.rvm/gems/ruby-2.0.0-p594:/Users/mobile/.rvm/gems/ruby-2.0.0-p594@global"
    MY_RUBY_HOME: "/Users/mobile/.rvm/rubies/ruby-2.0.0-p594"
    IRBRC:        "/Users/mobile/.rvm/rubies/ruby-2.0.0-p594/.irbrc"
    RUBYOPT:      ""
    gemset:       ""
like image 799
ubertao Avatar asked Feb 08 '23 18:02

ubertao


2 Answers

Uninstall/reinstall rake solved the problem.

$ gem uninstall rake
Successfully uninstalled rake-10.4.2
$ gem install rake
Fetching: rake-10.4.2.gem (100%)
Successfully installed rake-10.4.2
Parsing documentation for rake-10.4.2
Installing ri documentation for rake-10.4.2
Done installing documentation for rake after 1 seconds
1 gem installed
$rake
like image 187
ubertao Avatar answered Feb 23 '23 01:02

ubertao


I had the same issue. Just uninstalled the json gem and re-installed with the exact same version, which fixed my problems.

like image 34
Samwise Avatar answered Feb 23 '23 00:02

Samwise