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
Related
Running into ruby version clash when trying to start the rails debugger inside of VS Code. Sorry if this is a stupid question.. I'm normally a Js guy, very new to Rails
Getting this error :
rake (>= 0.8.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Uncaught exception: Your Ruby version is 2.3.7, but your Gemfile specified 2.3.1
/Library/Ruby/Gems/2.3.0/gems/bundler-1.17.3/lib/bundler/definition.rb:495:in `validate_ruby!'
/Library/Ruby/Gems/2.3.0/gems/bundler-1.17.3/lib/bundler/definition.rb:470:in `validate_runtime!'
.
.
.
When I type ruby --version in my console, I get ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]
Had this same issue.
Restarting the computer worked for me.
The vscode debugger console environment doesn't seem to update until a complete computer restart happens. Might be a bug or intentional.
I'm wondering why i got this error on particular situation.
One of my controller class has
require 'Kconv'
on top.
And after running app by "$ rails s", i got this error (cannot load such file -- Kconv) in only my centos5.10. My mac has no problem with the code and can work correctly.
Specs
My mac
Rails 4.2.0
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
gem 2.2.2
Yosemite 10.10.2
centos5.10
Rails 4.2.0
ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]
gem 2.4.8
CentOS release 5.10 (Final)
And one of tutorial site mentioned about need to install 'Kconv' by gem.
But both of my pc has error with it.
ERROR: Could not find a valid gem 'kconv' (>= 0) in any repository
ERROR: Possible alternatives: bconv, conv, iconv, sconv
My question is why this error happens even if these specs are almost same. Another tutorial site said this lib is included into general package. If so, if i use same ruby version, i don't get this error, do i?
The name of the file is kconv.rb, not Kconv.rb. On your Mac, you are presumably using a case-insensitive file system such as FAT, NTFS or HFS, whereas on your CentOS box, you are using a case-sensitive file system such as ext4, btrfs or ZFS.
So, it should be
require 'kconv'
and the fact that
require 'Kconv'
works on a case-insensitive file system is just pure dumb luck.
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.
Versions
Mac OS: OSX 10.10.2
Ruby: 2.2.1p85
Rails: 4.2.0
Context
I am following the "Install Rails" tutorial online at www.installrails.com. Finally made it through after encountering many errors. I am on the last step of creating a sample app, which it worked fine, and then running the server. Now, I run into another error.
Errors
Here is what I am seeing:
/Users/Work/.rvm/gems/ruby-2.2.1/gems/json-1.8.2/lib/json/ext/parser.bundle: [BUG] Segmentation fault at 0x00000000000418
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
-- 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
for more details.
-- Control frame information -----------------------------------------------
*A lot of information listed here*
-- Ruby level backtrace information ----------------------------------------
*A lot of information listed here*
-- Machine register context ------------------------------------------------
*A lot of information listed here*
-- C level backtrace information -------------------------------------------
*A lot of information listed here*
-- Other runtime information -----------------------------------------------
* Loaded script: bin/rails
* Loaded features:
*And then a long list of files listed here*
[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
Help
Now, I am wondering if it is the json gem that is causing a problem?
Let me know if you need any of the removed information. The bug report was really long so I removed the codes where it says A lot of information listed here for brevity.
Per a suggestion by #maxd, I ended up having to uninstall and reinstall ruby.
Here is the process I followed.
I uninstalled Ruby with command line rvm remove 2.2.1
I reinstall 2.2.1 with the command line rvm install 2.2.1
Then I reinstalled rails with command line sudo gem install rails
Then I used bundle install to reinstall missing gems
Next, I used gem install rubygems-update to update Rubygems from 2.0.14 to 2.1.
Then I reset gems to pristine condition with gem pristine --all.
Then for some reason I had to rerun bundle install because actionmailer 4.2.0 was no longer showing as being installed, even though it was in the list after the first bundle install.
Finally running rails -v gave me an output of Rails 4.2.0 instead of error codes.
So, I ran rails server and all is well.
I solved this problem. But I not certain this is a GOOD way.
first, I reinstalled ruby. since, I looks like version problem as I see.
rvm reinstall all
and gem install rails. After this process, I can run server with rails server command.
I hope this could be a your solution too. Have a good day :D
I was experiencing the same problem in my mac mini(M1). The following solution worked for me found in the developer forum.
sudo arch -x86_64 gem install ffi
Then
arch -x86_64 pod install
I have installed Redmine on cent-os. I have configured it on Apache with Passenger .And It s been used by hardly 400 people. At the particular point of time ,Ruby Process eats to much of memory. Almost 100% of the memory .
I am not able to see from where the leakage is going on in the ruby process. Just can see in the top ruby is reaching to 90% and some times more then 99%.
Is there any way to solve the issue. Any Deployment solution there or any way to check where is the process leakage in ruby code?
Here are some details of the version I am using on RVM
gem -v
1.8.24
ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
rails -v
Rails 2.3.14
Maybe you can follow the tips in this article: http://blog.phusion.nl/2012/09/21/the-right-way-to-deal-with-frozen-processes-on-unix/