Project

General

Profile

Error accessing projects page

Added by Miguel Rentes over 1 year ago

I've upgrade redmine on a debian 11 machine with the bullseye-backports repository enabled. Whenever I try to access any project I get the following error:

I, [2023-06-15T12:16:08.787835 #30421]  INFO -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee] Started GET "/redmine/projects/software/settings" for 192.10.10.10 at 2023-06-15 12:16:08 +0100
I, [2023-06-15T12:16:08.788803 #30421]  INFO -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee] Processing by ProjectsController#settings as HTML
I, [2023-06-15T12:16:08.788888 #30421]  INFO -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee]   Parameters: {"id"=>"software"}
I, [2023-06-15T12:16:08.795139 #30421]  INFO -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee]   Current user: admin (id=1)
I, [2023-06-15T12:16:08.916605 #30421]  INFO -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee]   Rendered projects/settings.html.erb within layouts/base (Duration: 112.1ms | Allocations: 34125)
I, [2023-06-15T12:16:08.938973 #30421]  INFO -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee]   Rendered layout layouts/base.html.erb (Duration: 134.5ms | Allocations: 42951)
I, [2023-06-15T12:16:08.944405 #30421]  INFO -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee] Completed 500 Internal Server Error in 155ms (Views: 114.9ms | ActiveRecord: 24.9ms | Allocations: 47478)
F, [2023-06-15T12:16:08.945273 #30421] FATAL -- : [a41c0f57-bd85-4454-8a9d-91156afb63ee]   
[a41c0f57-bd85-4454-8a9d-91156afb63ee] ActiveModel::MissingAttributeError (can't write unknown attribute ``):
[a41c0f57-bd85-4454-8a9d-91156afb63ee]   
[a41c0f57-bd85-4454-8a9d-91156afb63ee] lib/redmine/project_jump_box.rb:100:in `set_pref_project_ids'
[a41c0f57-bd85-4454-8a9d-91156afb63ee] lib/redmine/project_jump_box.rb:84:in `recently_used_project_ids='
[a41c0f57-bd85-4454-8a9d-91156afb63ee] lib/redmine/project_jump_box.rb:51:in `project_used'
[a41c0f57-bd85-4454-8a9d-91156afb63ee] app/controllers/application_controller.rb:466:in `record_project_usage'

Info:

Environment:
  Redmine version                5.0.4.stable
  Ruby version                   2.7.4-p191 (2021-07-07) [x86_64-linux-gnu]
  Rails version                  6.1.7.3
  Environment                    production
  Database adapter               PostgreSQL
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
Redmine settings:
  Redmine theme                  Default
SCM:
  Git                            2.30.2
  Filesystem                     
Redmine plugins:
  no plugin installed

I already did a database rake migration and restarted redmine but the error continues to persist. It seems that some configuration or database columns are missing. I'm using apache and mod_passenger.

Any help would be really appreciated since I don't know what to do more. Thank you.


Replies (2)

RE: Error accessing projects page - Added by Miguel Rentes over 1 year ago

I eventually found out what was causing the error. On the method

set_pref_project_ids

the variable @user.pref[key] was nil. key contains 'recently_used_projects_ids'. I don't know what I have to do to populate this UserPreference object to have this key, but I changed the code to only save the key new value if @user.pref[key] is not nil:

if old_value != new_value and ! @user.pref[key].nil?
  @user.pref[key] = new_value
  @user.pref.save
end

After this change I restarted redmine and the error no longer appears.

Hope this helps anyone. Thank you.

RE: Error accessing projects page - Added by Lorenzo Meneghetti over 1 year ago

Miguel Rentes wrote in RE: Error accessing projects page:

I eventually found out what was causing the error. On the method
[...]
the variable @user.pref[key] was nil. key contains 'recently_used_projects_ids'. I don't know what I have to do to populate this UserPreference object to have this key, but I changed the code to only save the key new value if @user.pref[key] is not nil:

[...]

After this change I restarted redmine and the error no longer appears.

Hope this helps anyone. Thank you.

My advice, you have data inconsistency on admin user preferences.
Instead of patching try to see if happens with all users.
If happens only with admin user you can delete prefs from console with
admin_user_instance.pref.destroy and then refresh prefs in /my/account page.
Lorenzo

    (1-2/2)