Limit the backtrace for rails console in Rails 7 - ruby-on-rails

When an exception is raised while running $ rails c, the logger writes over 100 lines of stack trace.
Does anyone know how to configure the logger to log N lines?
Rails 7, Ruby 3.1
I have tried the answer in set rails console stack backtrace limit permanently to no effect and obvious errors.

Related

What is causing a JSON parsing error in delayed_job on Heroku

I am seeing this error on Heroku in a ruby on rails 6.0.2 app.
JSON::ParserError: 767: unexpected token at '' (Most recent call first)
which is occuring at line 9 of app/bin/rake.
4 rescue LoadError => e
5 raise unless e.message.include?('spring')
6 end
7 require_relative '../config/boot'
8 require 'rake'
9 Rake.application.run
The traceback shows it is happening in the active_storage video_analyzer.rb file:
/app/vendor/ruby-2.6.5/lib/ruby/2.6.0/json/common.rb line 156 in parse
File /app/vendor/ruby-2.6.5/lib/ruby/2.6.0/json/common.rb line 156 in parse
File /app/vendor/bundle/ruby/2.6.0/gems/activestorage-6.0.2/lib/active_storage/analyzer/video_analyzer.rb line 107 in block in probe_from
And the video_analyzer is being called ultimately by delayed_job. The app is uploading videos, but I am seeing no problems in either the upload or viewing of the videos. So what is causing this exception? I only started seeing the problem after upgrading from rails 5 to rails 6.
Although I had included the ffmpeg gem, on heroku I still needed to install the ffmpeg binaries on heroku. I tried this buildpack with the following commands:
heroku buildpacks:add --index 1 https://github.com/laddhadhiraj/heroku-buildpack-ffmpeg
heroku config:set FFMPEG_BIN_URL="http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz"
However, the FFMPEG_BIN_URL was out of date. Nevertheless, the buildpack installs ffmpeg and ffprobe. It can be seen from the error message, that the problem is caused by the lack of ffprobe, so this seems to have fixed the error message. It not clear that activestorage functionality is working completely with ffmpeg as the following methods have not been installed, ffserver, ffmpeg-10bit, qt-faststart
If anyone knows of a more up-to-date buildpack, please post an answer or comment.

Trying to start rails console in rails app root gives me the

I'm in the root of my Rails app and have attempted to start the rails console a various number of ways, including rails c, bundle exec rails c, spring rails c, and bin/rails c to no avail. It simply returns the a message as if I had just typed in rails without any arguments.
Here's the message I get:
> rails c
Usage:
rails new APP_PATH [options]
I've used RVM to uninstall and reinstall my ruby version and have uninstalled and reinstalled my gemset.
I suspect it has something to do with spring but can't quite put my finger on it.
So after stumbling across these two stack overflow posts, #1, #2, which directed me to this Github issue in the rails repo.
Basically, running rake rails:update:bin generated new bins that ended up solving my problem.

Abort trap 6 after attempting to generate rails scaffold

Chapter 2 rails tutorial, I am trying to generate scaffold using:
$ rails generate scaffold User name:string email:string
I am getting the following error:
[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
I have tried to find this specific error with the abort trap: 6 on stackOF but can't. I am getting the same issue when I try:
$ bundle exec rake db:migrate
and even when I try to run the rails server
$ rails s
I found some info in the Ruby bug reports # https://bugs.ruby-lang.org/issues/8373
it says that I may have older versions of extension libraries for Ruby. How do I get rid of these or clean it up so that I don't keep getting this error?
bus.ruby gives one solution, but being VERY VERY new to this I don't understand it. The following solution is given:
"[BUG] unknown type 0x22" is most probably T_DATA for ruby 1.8.
You have an extension library (or more) for older ruby.
Try otool -L for followings.
1 /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/enc/encdb.bundle
2 /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/enc/trans/transdb.bundle
9 /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/pathname.bundle
Thanks so much for any help with this.
The above comment from user3353784 is correct. I was running ruby 2.2.0 and rails 4.2. The simplified command for newer versions of rvm is:
rvm gemset pristine

Stack level too deep trying to update from 3.0 to 3.1

I'm getting this error while trying to run 'rails s' after upgrading update from rails 3.0.10 to 3.1.0
~/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.3.10/lib/rack/builder.rb:40: stack level too deep
(SystemStackError)
Has anyone else run into this and solved the problem? Google search yields nothing except that it might involve gem dependencies.

Phusion Passenger is crashing...how can I get a stack trace?

I'm using Phusion Passenger 2.2.2 with a Rails 2.3.8 and 2.3.2 apps. Every once in awhile it will freeze and there is no response from the server when trying to access the rails applications. There is nothing in the apache log or the rails logs. I'm not talking about a 500 error or anything, there is just no response whatsoever. They don't respond until we restart apache.
I tried to follow these instructions to try to get a stack trace: http://www.modrails.com/documentation/Users%20guide%20Apache.html#debugging_frozen
I sent SIGABRT to the processes, according to the instructions, and they did not seem to care. Didn't see anything in the apache or rails logs.
The way to troubleshoot this problem on Passenger is to issue a kill -SIGABRT to the stuck Rails processes, and find their backtrace in the Rails log

Resources