Defect #33021

[v.4.0.5-stable] Internal Server Error 500 when accessing 'repository' tab

Added by Matthew Sexton about 1 month ago. Updated about 1 month ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-
Resolution: Affected version:4.0.5

Description

Using Arch Linux kernel version 5.5.3-arch1-1, Redmine served using mod_passenger (v6.0.4-2) on Apache (2.4.41-1). Trying to access 'repository' tab gives error 500. Changesets can be viewed, and git integration otherwise works well. Issues tagged in commit msgs are properly closed/referenced.

Environment:
  Redmine version                4.0.5.stable
  Ruby version                   2.7.0-p0 (2019-12-25) [x86_64-linux]
  Rails version                  5.2.3
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                sendmail
SCM:
  Git                            2.25.1
  Filesystem                     
Redmine plugins:
  redmine_messenger              1.0.6
App 244788 output: Started GET "/tracker/projects/(PROJECT)/repository" for (IP-ADDRESS) at 2020-02-18 11:18:50 -0500 
App 244788 output: Processing by RepositoriesController#show as HTML                                                
App 244788 output:   Parameters: {"id"=>"(LOCAL_USER)"}                                                                    
App 244788 output:   Current user: (REDMINE_USER) (id=5)                                                                   
App 244788 output: Completed 500 Internal Server Error in 30ms (ActiveRecord: 7.6ms)                                
App 244788 output:                                                                                                  
App 244788 output: FrozenError (can't modify frozen String: ""):                                                    
App 244788 output:   
App 244788 output: lib/redmine/scm/adapters/abstract_adapter.rb:279:in `force_encoding'
App 244788 output: lib/redmine/scm/adapters/abstract_adapter.rb:279:in `scm_iconv'
App 244788 output: lib/redmine/scm/adapters/git_adapter.rb:136:in `entries'
App 244788 output: app/models/repository/git.rb:98:in `scm_entries'
App 244788 output: app/models/repository.rb:204:in `entries'
App 244788 output: app/controllers/repositories_controller.rb:86:in `show'
App 244788 output: lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Related issues

Related to Redmine - Feature #31500: Ruby 2.7 support New

History

#1 Updated by Pavel Rosický about 1 month ago

redmine 4.0.5 doesn't support ruby 2.7 yet https://www.redmine.org/issues/31500

the error seems to be related to this change https://bugs.ruby-lang.org/issues/16150

https://github.com/redmine/redmine/blob/caa88a2ed308224edc66f411b1466a7e622994c3/app/controllers/repositories_controller.rb#L320
at this line, there's a "params[:path].to_s" that may be nil and "nil.to_s" now returns a frozen string

#2 Updated by Matthew Sexton about 1 month ago

Manually Downgraded the following packages:
ruby (2.7.0-1 => 2.6.5-1)
rubygems (3.1.2-4 => 3.0.6-1)
ruby-bundler (2.1.4-1 => 2.0.2-1)

and re-ran bundle install --without development test which fixed the problem. This was my mistaken, looking at the installation guide it does not list ruby 2.7 as supported.

However: It is a good note that I ran Redmine with Ruby 2.7 since December and in the entire time this was the only issue I ran into. Everything else worked pretty flawlessly.

#3 Updated by Go MAEDA about 1 month ago

#4 Updated by Anatol Pomozov about 1 month ago

It would be great to debug and fix this problem so Arch can switch to ruby2.7 and avoid pulling the old ruby version.

#5 Updated by Marius BALTEANU about 1 month ago

Anatol Pomozov wrote:

It would be great to debug and fix this problem so Arch can switch to ruby2.7 and avoid pulling the old ruby version.

Only Redmine 4.2.0 will have official support for ruby2.7, the fixes won't be back ported to previous versions. You will need to update your Redmine version when the release will be available or manually backport the fixes which I do not recommend.

#6 Updated by Anatol Pomozov about 1 month ago

Marius BALTEANU wrote:

Only Redmine 4.2.0 will have official support for ruby2.7, the fixes won't be back ported to previous versions.

I wonder what is the reason behind this development practice? ruby 2.7 is mostly compatible with 2.6. And Matthew example above confirms it:

I ran Redmine with Ruby 2.7 since December and in the entire time this was the only issue I ran into

From my experience making a script compatible with ruby2.7 does not require too much efforts. It would be great to see redmine 4.0 compatible with ruby 2.7.

#7 Updated by Pavel Rosický about 1 month ago

FYI, this issue is already fixed in Redmine 4.1.0 by https://github.com/redmine/redmine/commit/30e341db6963d71fccf2d1bf24744ab828bee151

From my experience making a script compatible with ruby2.7 does not require too much efforts.

I think the main reason why it can't be officially supported is you'll get tons of warnings on Ruby 2.7. Users would blame Redmine for that, but until it's fixed in Rails https://github.com/rails/rails/pull/38386 we can't do much about it. They'll probably won't fix it for Rails 5.2.x anyway...

Also available in: Atom PDF