Defect #10053

undefined method `<=>' for nil:NilClass when accessing the settings of a project

Added by Jordi Clariana almost 6 years ago. Updated over 5 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Project settings
Target version:1.3.2
Resolution:Fixed Affected version:1.1.2

Description

Hi,

I have this error when I access a specific project:

ActionView::TemplateError (undefined method `<=>' for nil:NilClass) on line #3 of app/views/projects/settings/_members.rhtml:
1: <%= error_messages_for 'member' %>
2: <% roles = Role.find_all_givable
3:    members = @project.member_principals.find(:all, :include => [:roles, :principal]).sort %>
4: 
5: <div class="splitcontentleft">
6: <% if members.any? %>

    app/models/member.rb:53:in `<=>'
    app/views/projects/settings/_members.rhtml:3:in `sort'
    app/views/projects/settings/_members.rhtml:3:in `_run_rhtml_app47views47projects47settings47_members46rhtml_locals_members_object_tab'
    app/views/common/_tabs.rhtml:24:in `_run_rhtml_app47views47common47_tabs46rhtml_locals_object_tabs'
    app/views/common/_tabs.rhtml:23:in `each'
    app/views/common/_tabs.rhtml:23:in `_run_rhtml_app47views47common47_tabs46rhtml_locals_object_tabs'
    app/helpers/application_helper.rb:204:in `render_tabs'
    app/views/projects/settings.rhtml:3:in `_run_rhtml_app47views47projects47settings46rhtml'

Rendering /data/www/redmine/public/500.html (500 Internal Server Error)

I have found this old issue: http://www.redmine.org/issues/4563, but executing:

ruby /var/www/redmine/script/runner -e production "Member.find(:all, :include => [:roles, :principal]).select {|m| m.roles.empty? || m.principal.nil?}"

do not return anything.

Am I doing something wrong or is this actually a bug?
If this is a DB problem, can you point me how to fix it?

Thanks.

Associated revisions

Revision 8863
Added by Jean-Philippe Lang almost 6 years ago

Fixed potential error when sorting members without role (#10053).

History

#1 Updated by Jordi Clariana almost 6 years ago

Forgot to mention my Redmine version: 1.3.0, I can't see how to update "Affected version" field...

#2 Updated by Derick Potgieter almost 6 years ago

Having the same issue only on certain projects. I have over 100 projects on redmine clustered over 3 mongrel servers with an apache load balancer in front. Most projects worked but some return this error after upgrading to 1.3.0

#3 Updated by Robson Peixoto almost 6 years ago

I solved it removing all user of the project direct from DB.

#4 Updated by Etienne Massip almost 6 years ago

Please give details according to SubmittingBugs.

And try to reproduce with no plugin installed.

#5 Updated by Jordi Clariana almost 6 years ago

Hi,

Etienne, here you have more info:
  • Database Version: Mysql 5.1.49
  • Ruby Version: 1.8.7
  • Rails Version: 2.3.5
  • Redmine Version: 1.1.2 (I said it was 1.3.0, but I was looking at Help tab, and it was a redirection to redmine.org, I didn't notice it :S)

I assume that the error stack trace is what I already posted.

About plugins I can't test it now (there's a lot of people working on this Redmine installation right now), but I'm preparing a test installation and I will try to reproduce the same error.

#6 Updated by Etienne Massip almost 6 years ago

  • Affected version (unused) set to 1.1.2
  • Affected version set to 1.1.2

#7 Updated by Jordi Clariana almost 6 years ago

Finally I tested it without plugins, and I get the same error.
Increasing log to debug did not help either. I just see the last SQL query, but I don't think is important, because it's run by 'project.member_principals.find' function, and what is really failing here is the data handling (I guess).

Any ideas?

Thanks.

#8 Updated by Jean-Philippe Lang almost 6 years ago

  • Category set to Project settings
  • Status changed from New to Confirmed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

You may have an inconsistent member (eg. member without roles) in your database and the sort method raises an error.
This should be fixed by r8863.

#9 Updated by Jordi Clariana almost 6 years ago

After applying the patch the error vanished and no further misfunction detected.
This is resolved to me.

Thanks.

#10 Updated by Jean-Philippe Lang almost 6 years ago

  • Status changed from Confirmed to Resolved
  • Target version set to 1.3.2

Thanks for the feedback.

#11 Updated by Jean-Philippe Lang almost 6 years ago

  • Subject changed from ActionView::TemplateError when accessing the settings of a project to undefined method `<=>' for nil:NilClass when accessing the settings of a project

#12 Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from Resolved to Closed

Merged.

Also available in: Atom PDF