I am getting this error when trying to run my rails app :
[FATAL] failed to allocate memory
This is on a new mac book air with lion. It used to run ok, I don't really know what I changed...
I also get this error when doing rake db:drop :
[BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin11.0.1]
-- control frame ----------
c:0001 p:0000 s:0002 b:0002 l:000498 d:000498 TOP
---------------------------
-- C level backtrace information -------------------------------------------
[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
Abort trap: 6
someone knows how I can fix this? Thanks!
Related
I'm running a system test in a Rails app on a MacBook M1 Big Sur OS and it's giving me a segmentation fault error.
I'm using Ruby 2.7.1 installed via rbenv
➜ which ruby
/Users/sc/.rbenv/shims/ruby
➜ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [-darwin20]
Now, the issue comes whenever I run a rails system test.
Our system tests are congigured with the headless_chrome Capybara driver, which has probably (not sure about this) something to do with the segmentation fault error.
This is what I get when I run the test:
[BUG] Segmentation fault at 0x000000001b543e20
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [-darwin20]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- Other runtime information -----------------------------------------------
* Loaded script: rails_test
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
4 ruby2_keywords.rb
5 /Users/sc/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/encdb.bundle
6 /Users/sc/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/enc/trans/transdb.bundle
7 /Users/sc/.rbenv/versions/2.7.1/lib/ruby/2.7.0/-darwin20/rbconfig.rb
8 /Users/sc/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/compatibility.rb
9 /Users/sc/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/defaults.rb
10 /Users/sc/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/deprecate.rb
And many more lines...
Any ideas on what's causing this error?
This happens because of a bug in Enumerator#next, happening in ruby 2.7.1 on Apple M1. Capybara uses it in Capybara::Result class.
The simpleset irb snippet to ensure this is your case is [1,2,3].to_enum.next:
irb(main):003:0> [1,2,3].to_enum.next
[BUG] Segmentation fault at 0x0000000004809020
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [-darwin20]
The best solution is to upgrade ruby version to 2.7.3, which does not have this bug.
(If you need to run the tests quickly and solve the core problem later, you can edit capybara's result.rb locally, as a stupid temporary workaround. But I strongly recommend to upgrade ruby version asap)
UPD: I have posted a bug report in a ruby bug tracker.
I ran into the same problem when running my tests. I was helped by the Ruby update to 2.7.3
I use ruby 1.9.3 in a rails application. I successfully installed ruby using rbenv and gcc 4.2 on OSX Yosemite and could install dependencies with bundler.
When I try to setup the database I get the following error:
bundle exec rake db:setup
foo already exists
foo_test already exists
ruby(31773,0x7fff79ac7300) malloc: *** error for object 0x7fe00a8c0dc8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
[1] 31773 abort bundle exec rake db:setup
After the first time I get a different error message:
$ bundle exec rake db:setup
-- create_table("foo", {:force=>true})
-> 0.0241s
...
-- create_table("bar", {:force=>true})
-> 0.0241s
/Users/jedi/code/foo/.bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/migration.rb:601: [BUG] Segmentation fault
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin14.3.0]
-- Control frame information -----------------------------------------------
c:0062 p:0012 s:0220 b:0220 l:000219 d:000219 METHOD /Users/jedi/code/foo/.bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/migration.rb:601
c:0061 p:0071 s:0216 b:0214 l:000195 d:000213 BLOCK /Users/jedi/code/foo/.bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/migration.rb:461
c:0060 p:0005 s:0212 b:0212 l:000201 d:000211 BLOCK /Users/jedi/code/foo/.bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/migration.rb:438
...
-- Ruby level backtrace information ----------------------------------------
/Users/jedi/code/foo/.bundle/ruby/1.9.1/bin/rake:23:in `<main>'
/Users/jedi/code/foo/.bundle/ruby/1.9.1/bin/rake:23:in `load'
...
[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 tried updating to ruby 2.0.0 and compiling ruby using clang, but always got the same. Any ideas?
This was caused by an incorrect version of zeromq being installed on the computer. We were using a gem that targets zeromq 3 but had version 4 installed.
I arrived to this conclusion after some binary search removing and adding dependencies from the Gemfile. Downgrading zeromq did the job.
To me it's still a mistery why the error report is so misleading, but problem solved.
Whenever I try to run sidekiq with this command
$ bundle exec sidekiq
I get this error:
/home/myname/.rvm/gems/ruby-1.9.2-p320#somename/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:9: [BUG] Segmentation fault (core dumped)
I am using:
Rails: 3.1.11
Ruby: 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
Ubuntu: 14.04.2 LTS
Sidekiq: ~> 2.15.2
Any help to resolve the issue will be much appreciated. Thanks.
i got this segmentation fault on my production server with similar configuration.i spent a lot of time to understand why is this error coming and what does it mean.BUT at the end,i ended up removing few unused gems from gemfile which removed this error.You can give it a try too.
I am trying to execute a Capistrano task that requires resetting a database but when I come upon a particular line of code I receive the error illustrated in the title. Here is the complete error message:
RAILS_ENV=testing script/runner 'Account.all.each(&:reindex_person)' exit status: 1
cd /var/local/openhub/current && RAILS_ENV=testing script/runner
'Account.all.each(&:reindex_person)' stdout: Nothing written
cd /var/local/openhub/current && RAILS_ENV=testing script/runner
'Account.all.each(&:reindex_person)' stderr:
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- script/../config/boot (LoadError)
As you can see in the message, the error is triggered by the script/runner command. To better understand the issue that I am having, I have turned to these three stack overflow questions with roughly the same error:
cannot load such file — script/../config/boot (LoadError) after OSX Mavericks
no such file to load — rubygems (LoadError)
Strange inability to require config/boot
I am using
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
Rails 2.3.18
From the suggestions in the questions, it seems that the problem was that multiple versions of ruby were installed in the OS and that by removing them until one remained, the problem could be fixed. That's not the case with me. When I run which -a ruby I get the output /usr/bin/ruby and I have only ruby 1.9.3 installed.
However, I noticed this little oddity in my system. /usr/bin/ruby1.9.1
This must be the error that I am having. The inconsistency is what I believe is causing the error, but it is strange to me because I am able to run script/server and script/console just fine.
What would be the solution for this, to my knowledge the system that I use does not have rvm. Do I need to uninstall ruby and re-install version 1.9.3? I am trying to better understand what problem I'm having because as it stands I am still a novice programmer and I'm a little hesitant to breaking my entire testing system by messing with the internals without a complete understanding of what is taking place. Help would be much appreciated. Thanks.
After upgrading my Ruby to 1.9.3-p429, I tried to start the Rails server. It told me rails was not installed so, I boldly did a 'gem install rails'. Now when I try to start the server, I'm getting this:
andrunix#amp-laptop~/code/madrilla$ rails s
/Users/andrunix/.rvm/gems/ruby-1.9.3-p429/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Abort trap: 6
I have no idea why that says, "ruby 1.8.7" in that output. Perhaps that's a clue to my problem.
But anyway, super frustrated at this point.
And by the way, this is on OS X.
Help me please!
Try to set the version you've installed as the default for your whole system:
rvm --default use ruby-1.9.3-p429