Project

General

Profile

After Upgrade to 1.0.0

Added by Ryan Lovelett over 13 years ago

Since upgrading to 1.0.0 I cannot list issues on one of my projects. I can view individual issues but clicking on the issues tab and going to the list view ends with a error 500. I'm not a Ruby developer can someone help me decipher what is going on here.

Best regards,
Ryan

Processing IssuesController#index (for xxx.xxx.xxx.xxx at 2010-07-19 18:58:30) [GET]
  Parameters: {"project_id"=>"the-project-title", "action"=>"index", "controller"=>"issues"}
Rendering template within layouts/base
Rendering issues/index.rhtml

ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #16 of app/views/issues/_list.rhtml:
13:     </tr></thead>
14:     <% previous_group = false %>
15:     <tbody>
16:     <% issue_list(issues) do |issue, level| -%>
17:   <% if @query.grouped? && (group = @query.group_by_column.value(issue)) != previous_group %>
18:     <% reset_cycle %>
19:     <tr class="group open">

    app/helpers/issues_helper.rb:28:in `issue_list'
    app/helpers/issues_helper.rb:23:in `each'
    app/helpers/issues_helper.rb:23:in `issue_list'
    app/views/issues/_list.rhtml:16
    app/views/issues/_list.rhtml:1:in `_run_rhtml_app47views47issues47_list46rhtml_locals_issues_list_object_query'
    app/views/issues/index.rhtml:62:in `_run_rhtml_app47views47issues47index46rhtml'
    app/controllers/issues_controller.rb:83
    app/controllers/issues_controller.rb:82:in `index'
    passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
    passenger (2.2.11) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
    passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
    passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
    passenger (2.2.11) lib/phusion_passenger/utils.rb:184:in `safe_fork'
    passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
    passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:163:in `start'
    passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
    passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
    passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
    passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
    passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
    passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
    passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
    passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

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

Replies (14)

RE: After Upgrade to 1.0.0 - Added by Mischa The Evil over 13 years ago

This looks a lot like issue #5907, filed by Sascha Drews.

RE: After Upgrade to 1.0.0 - Added by Stepan Volkov over 13 years ago

You not full make migrate "steps" in upgrade to 1.0.0.

See RedmineUpgrade Step-4

I hawe some problem in migrate from 0.9-stable to 1.0-stable.
I exec

# rake db:migrate RAILS_ENV=production

and see:

==  AddIssuesNestedSetsColumns: migrating =====================================
-- add_column(:issues, :parent_id, :integer, {:default=>nil})
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  column "parent_id" of relation "issues" already exists
: ALTER TABLE "issues" ADD COLUMN "parent_id" integer

humonoids translate: 'in database table "issues" column "parent_id" exists, and can't added again, it exist ;)

For test I run redmine, in issue list I hawe "your" problem:

ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #16 of app/views/issues/_list.rhtml:
16:     <% issue_list(issues) do |issue, level| -%>

My redmine database hosted at PostgreSQL, I simply drop column parent_id from table issues. (I think You always make full dump before upgrade!)

# psql -Upgsql redmine
Welcome to psql 8.3.0, the PostgreSQL interactive terminal.
redmine=# alter table issues drop column parent_id;
ALTER TABLE
redmine=# \q
then I run
  1. rake db:migrate RAILS_ENV=production
    again, and see other error:
PGError: ERROR:  column "lft" of relation "issues" already exists

heh, I drop column "lft", again run rake db:migrate RAILS_ENV=production

PGError: ERROR:  column "rgt" of relation "issues" already exists

oh, drop "rgt" colomn and run rake db:migrate RAILS_ENV=production

bingo!

# rake db:migrate RAILS_ENV=production
(in /usr/home/werd/redmine/trunk)
==  AddIssuesNestedSetsColumns: migrating =====================================
-- add_column(:issues, :parent_id, :integer, {:default=>nil})
   -> 0.0203s
-- add_column(:issues, :root_id, :integer, {:default=>nil})
   -> 0.0019s
-- add_column(:issues, :lft, :integer, {:default=>nil})
   -> 0.0018s
-- add_column(:issues, :rgt, :integer, {:default=>nil})
   -> 0.0018s
==  AddIssuesNestedSetsColumns: migrated (0.1846s) ============================

==  AddIndexOnIssuesNestedSet: migrating ======================================
-- add_index(:issues, [:root_id, :lft, :rgt])
   -> 0.0058s
==  AddIndexOnIssuesNestedSet: migrated (0.0060s) =============================

==  ChangeChangesPathLengthLimit: migrating ===================================
-- change_column(:changes, :path, :text, {:null=>false})
   -> 0.2177s
-- change_column(:changes, :from_path, :text)
   -> 0.2101s
==  ChangeChangesPathLengthLimit: migrated (0.4283s) ==========================

then run (as say in manual RedmineUpgrade

# rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
# rake db:migrate_plugins RAILS_ENV=production
# rake tmp:cache:clear
# rake tmp:sessions:clear

then start redmine, test - all work, I happy!

p.s. Sorry for long post and my little English.

RE: After Upgrade to 1.0.0 - Added by Ryan Lovelett over 13 years ago

I have run all of the steps in the Redmine Upgrade page that was linked to. Including:

rake db:migrate RAILS_ENV=production

I never received an error or anything of that nature during any of the steps.

RE: After Upgrade to 1.0.0 - Added by Ryan Lovelett over 13 years ago

Also, forgot to say I do not have the Subtasks plugin installed either. Or at least I don't think I do because there is no mention of it in the vendor/plugins directory.

RE: After Upgrade to 1.0.0 - Added by Felix Schäfer over 13 years ago

Ryan Lovelett wrote:

Also, forgot to say I do not have the Subtasks plugin installed either. Or at least I don't think I do because there is no mention of it in the vendor/plugins directory.

The doesn't only when it's installed, but also if it ever was installed on the db you are using. Other than that, see if logs/production.log yields anything useful, other than that we will need a way to reproduce and/or a dump of your data.

RE: After Upgrade to 1.0.0 - Added by Virginijus Magelinskas over 13 years ago

Similar problem for me:

Processing IssuesController#show (for xx.xx.xx.xx at 2010-07-20 09:24:23) [GET]
Parameters: {"action"=>"show", "id"=>"83", "controller"=>"issues"}
Rendering template within layouts/base
Rendering issues/show.rhtml

ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #62 of app/views/issues/show.rhtml:
59:
60: <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) >
61:
62: <
if ? || User.current.allowed_to?(:manage_subtasks, Herve Harster) %>
63: <hr />
64: <div id="issue_tree">
65: <div class="contextual">

app/views/issues/show.rhtml:62:in `_run_rhtml_app47views47issues47show46rhtml'
app/controllers/issues_controller.rb:124:in `show'
app/controllers/issues_controller.rb:123:in `show'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /home/mag/redmine-1.0/public/500.html (500 Internal Server Error)

RE: After Upgrade to 1.0.0 - Added by Ryan Lovelett over 13 years ago

Felix:

I'm fairly sure I have never installed that plugin.

You said you would like a way to reproduce and/or a dump of the data. Does this mean that you are wanting a dump of my SQL database? If so I can get you that. Please let me know I really need to get this resolved.

RE: After Upgrade to 1.0.0 - Added by Felix Schäfer over 13 years ago

Ryan, I have no idea where this could come from except from a plugin that would have used the same column names as redmine now does. Did you have any error or warning during the upgrade process? Could also please post your software versions? (what OS, what ruby, rails, db versions, what db, and so on.)

One thing you could try is on your updated DB to rebuild the issue trees (task/subtask relations) which I think is the cause of the problem here. I don't know what DB you are using, so the pseudo-SQL would be parent_id = NULL, root_id = id, lft = 1, rgt = 2 to be applied on every row in the issues table. The next step would be to delete the columns and recreate them, though I'd rather not have to go this far.

If the above SQL doesn't help or you can't execute it, please post the schema of the issues table and the content of the schema_migrations table (preferably as an attachment so as not to spam the forum to much).

RE: After Upgrade to 1.0.0 - Added by Sascha Drews over 13 years ago

Good news everyone, I could solve the problem.

See here

RE: After Upgrade to 1.0.0 - Added by Felix Schäfer over 13 years ago

Great, though this should happen in the migration already, so I don't know why it didn't work on your installation… Anyway, glad you got it working :-)

RE: After Upgrade to 1.0.0 - Added by Ryan Lovelett over 13 years ago

I can confirm that Sascha's SQL command fixed my issue as well.

Great find Sascha! Thanks so much.

RE: After Upgrade to 1.0.0 - Added by liny lin over 13 years ago

Sorry ot bother you.
Could someone tell me where I can add subtask after successfully upgrading to 1.0.0 RC?
I don't install any plugin and I did below db:migrate:

rake db:migrate RAILS_ENV=production 
rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
rake db:migrate_plugins RAILS_ENV=production 

Please kindly help me! Many thanks!

RE: After Upgrade to 1.0.0 - Added by Felix Schäfer over 13 years ago

liny lin wrote:

Could someone tell me where I can add subtask after successfully upgrading to 1.0.0 RC?

Administration > Roles and Permissions > The role you wan to add the permission to > Manage subtasks.

RE: After Upgrade to 1.0.0 - Added by Alex Popov about 13 years ago

Ryan Lovelett wrote:

Since upgrading to 1.0.0 I cannot list issues on one of my projects. I can view individual issues but clicking on the issues tab and going to the list view ends with a error 500. I'm not a Ruby developer can someone help me decipher what is going on here.

Best regards,
Ryan

[...]

One other thing to consider if your run db migrations, but still getting this error:

If you run any rake tasks from cron/scheduled tasks (e.g. fetching mail/changesets) make sure your tasks point to the proper Redmine instance.

I had an issue when upgrade was done into new directory, but fetch mail was running from the old directory and the issues were created without parent task properly set.

Query to fix issues created by old version of fetch mail:

select * from issues where root_id is NULL;
-- update issues set root_id = id, lft = 1, rgt = 2 where root_id is NULL;
    (1-14/14)