instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.43k stars 2.43k forks source link

strscan version error. #2166

Closed LordRatte closed 10 months ago

LordRatte commented 1 year ago

Summary:

Steps to reproduce:

  1. Instance is updated to commit fb3c1ff95934b39082dc4c1baf7aef5385ae3bca
  2. Start server.

Expected behavior:

Passenger correctly serves Canvas.

Actual behavior:

Only Apache starts but Passenger quits with an error that seems to relate to the Canvas app.

===============================================================================
[ N 2023-02-24 10:50:53.3200 3371/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
App 3404 output: Error: The application encountered the following error: You have already activated strscan 1.0.3, but your Gemfile requires strscan 3.0.5. Since strscan is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports strscan as a default gem. (Gem::LoadError)
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/runtime.rb:309:in `check_for_activated_spec!'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/runtime.rb:25:in `block in setup'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/spec_set.rb:136:in `each'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/spec_set.rb:136:in `each'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/runtime.rb:24:in `map'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/runtime.rb:24:in `setup'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler.rb:150:in `setup'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/setup.rb:20:in `block in <top (required)>'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/ui/shell.rb:136:in `with_level'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/ui/shell.rb:88:in `silence'
App 3404 output:     /usr/local/rvm/gems/ruby-2.7.4-dev/gems/bundler-2.2.33/lib/bundler/setup.rb:20:in `<top (required)>'
App 3404 output:     /usr/local/rvm/rubies/ruby-2.7.4-dev/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
App 3404 output:     /usr/local/rvm/rubies/ruby-2.7.4-dev/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
App 3404 output:     /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:380:in `activate_gem'
App 3404 output:     /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
App 3404 output:     /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:544:in `running_bundler'
App 3404 output:     /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
App 3404 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:91:in `preload_app'
App 3404 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
App 3404 output:     /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:397:in `run_block_and_record_step_progress'
App 3404 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
App 3404 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 3404 output:     /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
[ E 2023-02-24 10:50:57.7210 3371/Tf age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/canvas: The application encountered the following error: You have already activated strscan 1.0.3, but your Gemfile requires strscan 3.0.5. Since strscan is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports strscan as a default gem. (Gem::LoadError)

Additional notes:

In the error message before I manually set the Ruby version to 2.7.4(-dev) but I also tried it before that with the official instructions of using the brightbox ppa and in that case it was using 2.7.5(-dev) and also failing in the same way.

LordRatte commented 1 year ago

I found a workaround for now by appending the following to the Gemfile

gem 'strscan', '1.0.3'
Den4200 commented 1 year ago

I found a workaround for now by appending the following to the Gemfile

gem 'strscan', '1.0.3'

I'm having the same issue and while this workaround does work to start Canvas, the automated jobs daemon fails to start.

LordRatte commented 1 year ago

I found a workaround for now by appending the following to the Gemfile

gem 'strscan', '1.0.3'

I'm having the same issue and while this workaround does work to start Canvas, the automated jobs daemon fails to start.

Funny. My jobs server seems to be working fine. Are you on the exact same commit?

danivovich commented 1 year ago

I am seeing the same issue. With or without gem 'strscan', '1.0.3' delayed_job won't boot with the same "You have already activated" error. Adding the gem line does solve the apache passenger boot issue.

I'm using: Bundler 2.3.26 Ruby 2.7.7p221 built with ruby-build and installed into /usr/local/bin (not using rvm or rbenv) I've got passenger set to use that ruby, and logs indicate that passenger is using the right user account to boot

danivovich commented 1 year ago

I'm able to get around this by updating the version of net-imap to 0.3.4 in the Gemfile.d/app.rb file. This removes the runtime dependency on the older strscan and then everything is happy with the activated version of the default strscan gem. I don't know if this will have other issues due to the gem bump, a quick review of the changelog on net-imap makes me suspect it will be fine, and I'm not particularly concerned about imap integration in my use case, so you needs may vary. I also updated to bundler 2.4.8 and system rubygems to 3.4.8 which seems to aid in everything playing nice with the default gem for strscan. I'll continue to update here if I figure anything else out or find any issues with my approach.

RedaElHajjaji commented 1 year ago

Adding gem 'strscan', '3.0.5' to the Gemfile will fixe this problem

Note : you have to install it using the following command : gem install strscan -v 3.0.5

amg-web commented 1 year ago

it's possible to edit passenger config in virtualhost config (bundler option)

jimfangx commented 1 year ago

Adding gem 'strscan', '3.0.5' to the Gemfile will fixe this problem

Note : you have to install it using the following command : gem install strscan -v 3.0.5

I had a similar issue here. You might also have to set the new strscan version as default

ccutrer commented 10 months ago

Do not use --default when manually installing a gem. It does not do what you think it does. It marks a gem as being part of the Ruby distribution.

That said, these dependencies have been updated on master, so you shouldn't be having these problems anymore.