Project

General

Profile

Actions

Defect #7317

closed

Gantt tab gives internal error due to nil avatar icon

Added by Luke Dixon about 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Normal
Category:
Gantt
Target version:
Start date:
2011-01-13
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Hello.

All was working fine for the last few days since i installed it, including the Gantt chart tab.

However after setting the due date on one of the versions, the Gantt tab now will not load and gives an Internal Error (500).

I read some old issues regarding blank Strings but they were resolved.

Ruby version 1.8.7 (i686-linux)
RubyGems version 1.4.2
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Edge Rails revision unknown
Application root /home/nicedist/redmine-1.1.0
Environment production
Database adapter mysql
Database schema version 20101114115359

Error in production.log:
ActionView::TemplateError (can't convert nil into String) on line #63 of app/views/gantts/show.html.erb:
60: # Width of the entire chart
61: g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
62:
63: @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width)
64:
65: g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
66: t_height = g_height + headers_height

    lib/redmine/helpers/gantt.rb:356:in `subject_for_issue'
    lib/redmine/helpers/gantt.rb:221:in `render_issues'
    lib/redmine/helpers/gantt.rb:220:in `each'
    lib/redmine/helpers/gantt.rb:220:in `render_issues'
    lib/redmine/helpers/gantt.rb:251:in `render_version'
    lib/redmine/helpers/gantt.rb:203:in `render_project'
    lib/redmine/helpers/gantt.rb:202:in `each'
    lib/redmine/helpers/gantt.rb:202:in `render_project'
    lib/redmine/helpers/gantt.rb:166:in `render'
    app/views/gantts/show.html.erb:63
    app/controllers/gantts_controller.rb:26:in `show'
    app/controllers/gantts_controller.rb:25:in `show'

Rendering /home/nicedist/redmine-1.1.0/public/500.html (500 Internal Server Error)

If there's nay more info you need please let me know.
Cheers!

Actions #1

Updated by Etienne Massip about 13 years ago

Are you using gravatars ?

Actions #2

Updated by Luke Dixon about 13 years ago

Yes i am.

Actions #3

Updated by Etienne Massip about 13 years ago

What does your mail address, as filled in your profile, looks like to (just replace ascii chars, please) ?

Actions #4

Updated by Etienne Massip about 13 years ago

Must be an exception raised in gravatar_url() because of MD5 gem or whatever.

could you remove the rescue nil at the end of line 874 of app/helpers/application_helper.rb, try again then report the new exception stack ?

Actions #5

Updated by David Barbion about 13 years ago

I made the modification in app/helpers/application_helper.rb but I still have the same exception stack...

Actions #6

Updated by Etienne Massip about 13 years ago

Did you restart your web server before testing ?

Actions #7

Updated by Etienne Massip about 13 years ago

Note : line is now 892 :

...
return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil
...
Actions #8

Updated by Etienne Massip about 13 years ago

The only other possibility is that someone, assigned to an issue, has a blank e-mail address.

Actions #9

Updated by Etienne Massip about 13 years ago

Which should not happen because mail address is not supposed to be blank.

Actions #10

Updated by Terence Mill about 13 years ago

We have same error here!

Actions #11

Updated by Etienne Massip about 13 years ago

If you don't have any assignee with a blank mail address (note 8), could you try with the above mentioned change (notes 5 & 7) ?

Actions #12

Updated by Terence Mill about 13 years ago

I checked all users (also disabled ones) have an email string <>"")
I changed line app/helpers/application_helper.rb 874
from

return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil

to
return gravatar(email.to_s.downcase, options) unless email.blank?

restarted apache and called gant tab

Error still is


ActionView::TemplateError (can't convert nil into String) on line #63 of app/views/gantts/show.html.erb:
60: # Width of the entire chart    
61: g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
62: 
63: @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width)
64: 
65: g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
66: t_height = g_height + headers_height

    lib/redmine/helpers/gantt.rb:356:in `subject_for_issue'
    lib/redmine/helpers/gantt.rb:221:in `render_issues'
    lib/redmine/helpers/gantt.rb:220:in `each'
    lib/redmine/helpers/gantt.rb:220:in `render_issues'
    lib/redmine/helpers/gantt.rb:197:in `render_project'
    lib/redmine/helpers/gantt.rb:209:in `render_project'
    lib/redmine/helpers/gantt.rb:208:in `render_project'
    lib/redmine/helpers/gantt.rb:209:in `render_project'
    lib/redmine/helpers/gantt.rb:208:in `render_project'
    lib/redmine/helpers/gantt.rb:166:in `render'
    app/views/gantts/show.html.erb:63
    app/controllers/gantts_controller.rb:26:in `show'
    app/controllers/gantts_controller.rb:25:in `show'
    passenger (2.2.14) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
    passenger (2.2.14) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
    passenger (2.2.14) lib/phusion_passenger/utils.rb:252:in `safe_fork'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:163:in `start'
    passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
    passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Bad issue, cause i wanted to present redmine as new bug tracking system tomorrow.
Any ideas for a quick fix, altough disabling gant module?
Tx for help!

Actions #13

Updated by Etienne Massip about 13 years ago

You can just disable gravatars.

Actions #14

Updated by Terence Mill about 13 years ago

Etienne Massip wrote:

You can just disable gravatars.

I noticed that on some projects it working and on other not.
I am not 100% sure, but the difference seems to be that the projects it is working are "leaf" projects, mean there are no sub projects
And it looks like as the parent projects is call gant chart, don't have "own issues but only issues come from child projects.
Does that maybe help to track down the problem?

I am using Wavatars, bou do you mean diabled the user pictures completly?

Actions #15

Updated by Etienne Massip about 13 years ago

Could you try replacing the

return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil

with
return gravatar(email.to_s.downcase, options) || '' unless email.blank? rescue nil

?

And yes, I meant that (only if you want to show the Gantt).

Actions #16

Updated by Terence Mill about 13 years ago

Doesn't change things better :(

Actions #17

Updated by Jean-Philippe Lang about 13 years ago

ApplicationHelper#avatar may return nil, empty string or whatever so this patch should be an easy fix:

Index: lib/redmine/helpers/gantt.rb
===================================================================
--- lib/redmine/helpers/gantt.rb    (revision 4949)
+++ lib/redmine/helpers/gantt.rb    (working copy)
@@ -353,7 +353,7 @@
           subject = "<span class='#{css_classes}'>" 
           if issue.assigned_to.present?
             assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name
-            subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string)
+            subject << view.avatar(issue.assigned_to, :class => 'gravatar icon-gravatar', :size => 10, :title => assigned_string).to_s
           end
           subject << view.link_to_issue(issue)
           subject << '</span>'

Do not forget to restart.

Actions #18

Updated by Etienne Massip about 13 years ago

God damn it !

The only way it can return nil is either because an exception has been raised by gravatar(...) or because gravatar(...) itself returns nil, and we just checked both, didn't we ?

Actions #19

Updated by Terence Mill about 13 years ago

Terence Mill wrote:

Doesn't change things better :(

BTW. From my point of view this BUG has at least priotity high!

Actions #20

Updated by Jean-Philippe Lang about 13 years ago

Do you mean you still have the error? Can you give the exact version or branch/revision you're using?

Actions #21

Updated by Etienne Massip about 13 years ago

What plugins are you actually running with ?

Actions #22

Updated by Terence Mill about 13 years ago

Terence Mill wrote:

Terence Mill wrote:

Doesn't change things better :(

BTW. From my point of view this BUG has at least priotity high!

I made some more tests and the theory that it is not working for parents, does not hold, because i also found some procejts, it is working. I activated same modules on parent projects it is not working as on that ones it is working, but that doesn't change things.
I also tested the threory that the project itself but at least on issue (in any tracker) to work around, but this doesn not hold also.

I can check other test cases if you tell me..

Hopefully this bug will be solved soon, because

Actions #23

Updated by Terence Mill about 13 years ago

Jean-Philippe Lang wrote:

ApplicationHelper#avatar may return nil, empty string or whatever so this patch should be an easy fix:

[...]

Do not forget to restart.

You won the prize! Fix seems to work ..

Thank our so much ;)

Actions #24

Updated by Terence Mill about 13 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
Actions #25

Updated by Jean-Philippe Lang about 13 years ago

  • Target version set to 1.1.2
Actions #26

Updated by Etienne Massip about 13 years ago

Doesn't this fix have any effect on issue subject icon rendering ?

Actions #27

Updated by Etienne Massip about 13 years ago

  • Subject changed from Gantt tab gives internal error. to Gantt tab gives internal error due to nil avatar icon
Actions #28

Updated by Jean-Philippe Lang about 13 years ago

  • Resolution set to Fixed

Fix committed in r4968.

Etienne Massip wrote:

Doesn't this fix have any effect on issue subject icon rendering ?

It certainly does. But I'm not sure it's worth to handle it.

Actions #29

Updated by Jean-Philippe Lang about 13 years ago

Merged in 1.1-stable in r4969.

Actions #30

Updated by Jean-Philippe Lang about 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF