Project

General

Profile

Actions

Defect #5964

closed

Error 500 when adding a subtask

Added by Thibaut Cuvelier over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
Issues
Target version:
-
Start date:
2010-07-26
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

When I try to add a new subtask to an existing task, I get a 500 error:

Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine administrator for assistance.

I get redirected to an URL like http://projets.developpez.com/projects/add-libv2/issues/new?issue%5Bparent_issue_id%5D=740 when clicking on the Add button.

ruby 1.8.6 (2009-06-08 patchlevel 369)
Rails 2.3.5
Redmine 1.0.0, downloaded today
MySQL Ver 14.12 Distrib 5.0.51b

The log excerpt:

Processing IssuesController#new [GET]
  Parameters: {"project_id"=>"add-libv2", "action"=>"new", "controller"=>"issues", "issue"=>{"parent_issue_id"=>"387"}}

NoMethodError (undefined method `-' for nil:NilClass):
  app/models/issue.rb:232:in `safe_attributes='
  app/controllers/issues_controller.rb:462:in `build_new_issue_from_params'
  passenger (2.2.3) lib/phusion_passenger/rack/request_handler.rb:91:in `process_request'
  passenger (2.2.3) lib/phusion_passenger/abstract_request_handler.rb:206:in `main_loop'
  passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:376:in `start_request_handler'
  passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:334:in `handle_spawn_application'
  passenger (2.2.3) lib/phusion_passenger/utils.rb:182:in `safe_fork'
  passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:332:in `handle_spawn_application'
  passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `__send__'
  passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `main_loop'
  passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:195:in `start_synchronously'
  passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:162:in `start'
  passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
  passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:261:in `spawn_rails_application'
  passenger (2.2.3) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
  passenger (2.2.3) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  passenger (2.2.3) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:254:in `spawn_rails_application'
  passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:153:in `spawn_application'
  passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:286:in `handle_spawn_application'
  passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `__send__'
  passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `main_loop'
  passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:195:in `start_synchronously'

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

If you need anything else...

Actions #1

Updated by Thibaut Cuvelier over 13 years ago

I made a mistake in the title: adding a simple issue is giving another 500 error! I'll have to switch back to 0.9.6 for now... Here is the log:

Processing IssuesController#new [GET]
  Parameters: {"parent_issue_id"=>"387", "project_id"=>"add-libv2", "action"=>"new", "controller"=>"issues", "issue"=>""}
Rendering template within layouts/base
Rendering issues/new

ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #10 of app/views/issues/_attributes.rhtml:
7: <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p>
8: <% end %>
9: 
10: <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p>
11: <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
12: <% unless @project.issue_categories.empty? %>
13: <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>

    app/views/issues/_attributes.rhtml:10:in `_run_rhtml_app47views47issues47_attributes46rhtml_locals_attributes_object'
    app/views/issues/_attributes.rhtml:1:in `_run_rhtml_app47views47issues47_attributes46rhtml_locals_attributes_object'
    app/views/issues/_form.rhtml:26:in `_run_rhtml_app47views47issues47_form46rhtml_locals_f_form_object'
    app/views/issues/new.rhtml:7:in `_run_rhtml_app47views47issues47new46rhtml'
    app/helpers/application_helper.rb:669:in `labelled_tabular_form_for'
    app/views/issues/new.rhtml:3:in `_run_rhtml_app47views47issues47new46rhtml'
    app/controllers/issues_controller.rb:135:in `new'
    passenger (2.2.3) lib/phusion_passenger/rack/request_handler.rb:91:in `process_request'
    passenger (2.2.3) lib/phusion_passenger/abstract_request_handler.rb:206:in `main_loop'
    passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:376:in `start_request_handler'
    passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:334:in `handle_spawn_application'
    passenger (2.2.3) lib/phusion_passenger/utils.rb:182:in `safe_fork'
    passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:332:in `handle_spawn_application'
    passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `__send__'
    passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `main_loop'
    passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:195:in `start_synchronously'
    passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:162:in `start'
    passenger (2.2.3) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
    passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:261:in `spawn_rails_application'
    passenger (2.2.3) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    passenger (2.2.3) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    passenger (2.2.3) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:254:in `spawn_rails_application'
    passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:153:in `spawn_application'
    passenger (2.2.3) lib/phusion_passenger/spawn_manager.rb:286:in `handle_spawn_application'
    passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `__send__'
    passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:351:in `main_loop'
    passenger (2.2.3) lib/phusion_passenger/abstract_server.rb:195:in `start_synchronously'

Rendering /.../redmine/public/500.html (500 Internal Server Error)
Actions #2

Updated by Mikhail Sviridov over 13 years ago

123

Actions #3

Updated by Felix Schäfer over 13 years ago

Did you have any error while updating, for example while migrating the database?

Actions #4

Updated by Thibaut Cuvelier over 13 years ago

Not a single one, the update went without any problem. I followed the guide presented on http://www.redmine.org/wiki/redmine/RedmineUpgrade.

Actions #5

Updated by Felix Schäfer over 13 years ago

I wasn't able to find the code parts your installation is complaining about… Did you restart redmine after upgrading? What plugins do you have installed? Have you ever had the subtasks plugin installed on that database?

Actions #6

Updated by Thibaut Cuvelier over 13 years ago

I did restart Redmine after upgrading, as well as emptying the cache and the sessions, as asked in the Upgrade manual. Here are my plugins:

Google Analytics plugin 0.2.0
Charts Plugin 0.1.0 (0.0.14 on Redmine 0.9.6)
Redmine Drafts plugin 0.1.1
Redmine Graphs plugin 0.1.0
Redmine Wiki Extensions plugin 0.2.2
Redmine Wiki Permissions plugin 0.0.1

Previously, I had:
Redmine Todo Lists plugin 0.0.4.1 (only on Redmine 0.9.6, as I hoped to migrate these tasks to a native feature)
ezFaq 0.3.4 (uninstalled, as it did not match our expectancies)

I never installed the subtasks plugin. That is really all I have...

Actions #7

Updated by Felix Schäfer over 13 years ago

Please test if you still get the error without the plugins, not sure if any of them doesn't override some views and/or controllers.

Actions #8

Updated by Thibaut Cuvelier over 13 years ago

I moved all the plugins into another folder, restarted Redmine, emptied the cache, checked if Redmine show any plugins (the page admin/plugins said, "No data to show"), and nothing changed...

Actions #9

Updated by Nick Peelman over 13 years ago

I am seeing similar issues when trying to use my cc_addresses plugin (http://github.com/peelman/redmine_cc_addresses). The culprit appears to be safe_attributes, and the fact that you guys have now ratcheted down what attributes Issue.new will process. There doesn’t appear to be a way to extend that (easily), at least not a documented way, and you’re kneecapping the functionality of a lot of existing and potential plugins by restricting this (you completely break accepts_nested_attributes_for).

Actions #10

Updated by Jean-Baptiste Barth over 13 years ago

Before all, make a backup of your DB.

Your 2 errors seem to occur when calling Issue#leaf? method, which is part of awesome_nested_set plugin. Can you confirm this in a console :

ruby script/console -e production
>> Issue.first.leaf?

If it gives you a 500 error, I suspect you have missing left or right columns in your issues table, which means your migrations did not work properly (maybe failed silently). You can verify this in a console too :

>> Issue.count(:conditions => {:rgt => nil})

And if it's not "0", you can try to rebuild these fields in a console with :

>> Issue.rebuild!

I'll have a deeper look at it, since I remember our definition of "leaf?" is modified and it's not the same as recent versions of awesome_nested_set.

Actions #11

Updated by Thibaut Cuvelier over 13 years ago

Your 2 errors seem to occur when calling Issue#leaf? method, which is part of awesome_nested_set plugin. Can you confirm this in a console :

Well ... this plugin has never been installed ...

However, I get stoned by Ruby when trying your line:

/usr/lib/ruby/1.8/optparse.rb:1448:in `complete': invalid option: -e (OptionParser::InvalidOption)
        from /usr/lib/ruby/1.8/optparse.rb:1446:in `catch'
        from /usr/lib/ruby/1.8/optparse.rb:1446:in `complete'
        from /usr/lib/ruby/1.8/optparse.rb:1285:in `parse_in_order'
        from /usr/lib/ruby/1.8/optparse.rb:1252:in `catch'
        from /usr/lib/ruby/1.8/optparse.rb:1252:in `parse_in_order'
        from /usr/lib/ruby/1.8/optparse.rb:1246:in `order!'
        from /usr/lib/ruby/1.8/optparse.rb:1337:in `permute!'
        from /usr/lib/ruby/1.8/optparse.rb:1358:in `parse!'
        from /home/developpez/www/redmine/vendor/rails/railties/lib/commands/console.rb:11
        from /usr/lib/ruby/1.8/optparse.rb:789:in `initialize'
        from /home/developpez/www/redmine/vendor/rails/railties/lib/commands/console.rb:6:in `new'
        from /home/developpez/www/redmine/vendor/rails/railties/lib/commands/console.rb:6
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from script/console:3

Without that parameter, I get this when entering the second line:

NoMethodError: undefined method `leaf?' for #<Issue:0xb63c0eb8>
        from /.../redmine/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:255:in `method_missing'
        from (irb):1

If it gives you a 500 error, I suspect you have missing left or right columns in your issues table, which means your migrations did not work properly (maybe failed silently). You can verify this in a console too : [...]

This gives me:

=> 24

nd if it's not "0", you can try to rebuild these fields in a console with : [...]

Err ...

NoMethodError: undefined method `rebuild!' for #<Class:0xb687d62c>
        from /.../redmine/vendor/rails/activerecord/lib/active_record/base.rb:1959:in `method_missing'
        from (irb):2
Actions #12

Updated by Jean-Baptiste Barth over 13 years ago

Thibaut Cuvelier wrote:

Your 2 errors seem to occur when calling Issue#leaf? method, which is part of awesome_nested_set plugin. Can you confirm this in a console :

Well ... this plugin has never been installed ...

It's part of redmine core, it's not a plugin a user have to install, it's shipped with redmine. Sorry the term "plugin" wasn't clear.

However, I get stoned by Ruby when trying your line:

Sorry there's no -e you're right.

[...]

Without that parameter, I get this when entering the second line:

Be careful to be in the same environment as your web server. If you run redmine in production mode, you should try ruby script/console production so that you're on the same environment. If not, verify your 2 environments hit the same database..

If it gives you a 500 error, I suspect you have missing left or right columns in your issues table, which means your migrations did not work properly (maybe failed silently). You can verify this in a console too : [...]

This gives me:

OK, so I guess you're on the good DB.

NoMethodError: undefined method `rebuild!' for #<Class:0xb687d62c>
=> this is not normal at all. If you don't see:

>> Issue.rebuild!
=> true

then you can be sure that your code base has a problem. It's not only your database, your files are not in 1.0.0 version. Maybe your "app/models/issue.rb" is not in the right version (it should contain a "acts_as_nested_set" line not too far from the top) or you're missing the "awesome_nested_set" subdirectory in "vendor/plugins".

Actions #13

Updated by Jean-Baptiste Barth over 13 years ago

Just one more thing : when you'll have files in 1.0.0 version and db:migrate run correctly, Issue.rebuild! may not be sufficient. If problems persists after you ran Issue.rebuild! and it returned "true", you can try Issue.update_all('lft = null, rgt = null') then run Issue.rebuild!. It will force the calculation of those fields on all issues.

Actions #14

Updated by Thibaut Cuvelier over 13 years ago

OK, I tried with a freshly downloaded Redmine 1.0.0, with copied database.yml and email.yml, not any other file.

>>Issue.first.leaf?
=>true
>> Issue.count(:conditions => {:rgt => nil})
=> 25
>> Issue.rebuild!
=> (...) (a lot of blob, it seems to be a database dump:)
[...] #<Issue id: 779, tracker_id: 2, project_id: 68, subject: "Parser YAML", description: "YAML est au moins aussi lisible que le XML en étan...", due_date: nil, category_id: nil, status_id: 1, assigned_to_id: nil, priority_id: 4, fixed_version_id: nil, author_id: 254882, lock_version: 0, created_on: "2010-07-23 21:29:06", updated_on: "2010-07-23 21:29:06", start_date: "2010-07-23", done_ratio: 0, estimated_hours: nil, parent_id: nil, root_id: 779, lft: 1, rgt: 2>]
>> Issue.update_all('lft = null, rgt = null')
=> 750
>> Issue.rebuild!
=> (the same)

The task rake db:migrate RAILS_ENV=production did not output any error. And I still get 500 errors...

Actions #15

Updated by Jean-Baptiste Barth over 13 years ago

OK. Now retry Issue.count(:conditions => {:rgt => nil}), you should get "0". The method that used to bring you problems now works. So if you get 500 errors now, I guess they are not the same as before.

I strongly encourage you to post something on the forum so we continue the discussion there, or it could be by mail or on IRC if you want (much more reactive if there's somebody there at the moment). We could even continue conversation in French on IRC, if might be easier for both of us... I'm pretty sure we could solve all this simply so that you get a redmine-1.0.0 running soon!

Can you confirm your original issue has gone so that we close this ticket as invalid, considering there was a problem with the files in your first upgrade ?

Actions #16

Updated by Thibaut Cuvelier over 13 years ago

  • Status changed from New to Resolved

Yes, it does now return 0. And, today, I do not get any 500 error, so I think all of this is now solved and unreproducible. It is now running perfectly well, except some style issues inside our unified layout.

Thank you so much!

Actions #17

Updated by Strubbl Master over 13 years ago

i have the same error like Thibaut. It occurs in the stable 1.0.0 version when i click on "new issue" in any project.

Thibaut Cuvelier wrote:

I made a mistake in the title: adding a simple issue is giving another 500 error! I'll have to switch back to 0.9.6 for now... Here is the log:

[...]

i get nearly the same error after my upgrade (no error occured while upgrading) from 0.9.2 to 1.0.0:

Processing IssuesController#new (for 1.2.3.4 at 2010-08-21 20:26:10) [GET]
  Parameters: {"project_id"=>"sx14", "action"=>"new", "controller"=>"issues"}
Rendering template within layouts/base
Rendering issues/new

ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #10 of app/views/issues/_attributes.rhtml:
7: <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p>
8: <% end %>
9: 
10: <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p>
11: <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
12: <% unless @project.issue_categories.empty? %>
13: <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>

    app/views/issues/_attributes.rhtml:10:in `_run_rhtml_app47views47issues47_attributes46rhtml_locals_attributes_object'
    app/views/issues/_attributes.rhtml:1:in `_run_rhtml_app47views47issues47_attributes46rhtml_locals_attributes_object'
    app/views/issues/_form.rhtml:26:in `_run_rhtml_app47views47issues47_form46rhtml_locals_f_form_object'
    app/views/issues/new.rhtml:7:in `_run_rhtml_app47views47issues47new46rhtml'
    app/helpers/application_helper.rb:669:in `labelled_tabular_form_for'
    app/views/issues/new.rhtml:3:in `_run_rhtml_app47views47issues47new46rhtml'
    app/controllers/issues_controller.rb:135:in `new'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /var/www/redmine-1.0.0/public/500.html (500 Internal Server Error)

i ran the "tests" on the console Thibaut should ran, too. but nothing failed. everything was okay. in the irc i got the hint to test this solution: http://www.redmine.org/issues/5608#note-3
but it didn't work, too.

can anyone help?

Actions #18

Updated by Jean-Baptiste Barth over 13 years ago

Try the same I advised to Thibaut. If it doesn't work, either your database has not been migrated, either you don't have correct 1.0.0(RC) files in your installation.

Actions #19

Updated by Strubbl Master over 13 years ago

i ran the "tests" on the console Thibaut should ran, too.

I tried everything you advised to Thibaut. But nothing made it work. My database migration doesn't throw an error and any other stuff i tried, mentioned here in this ticket, doesn't get the error away :(

Actions #20

Updated by Strubbl Master over 13 years ago

i ran the "tests" on the console Thibaut should ran, too.

I tried everything you advised to Thibaut. But nothing made it work. My database migration doesn't throw an error and any other stuff i tried, mentioned here in this ticket, doesn't get the error away :(

Actions #21

Updated by Florian Westreicher over 13 years ago

We had similar issues.
The fix was to not follow the guide on updating 100% ;)
It says you shall copy your plugins to the new folder. What we did was copying the whole folder - which was wrong.
Instead of copying the whole old plugin folder we only copied the plugins we use (charts) and now everything seems to work again.

Actions #22

Updated by Felix Schäfer over 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF