TravisSpangle / redmine_spent_time_in_issue_description

Redmine Plugin that drops Time Entry data into the Issue Description
16 stars 16 forks source link

Error 500 when displaying an issue #13

Closed frconil closed 9 years ago

frconil commented 9 years ago

Referring to https://github.com/TravisSpangle/redmine_spent_time_in_issue_description/issues/12 :

Hi,

I can access the config panel for the plugin after installing v2 of the plugin and running the necessary rake tasks (as per http://www.redmine.org/projects/redmine/wiki/Plugins) to remove the old version and install the new one, but now I get the following error when trying to display an issue:

Processing by IssuesController#show as HTML
  Parameters: {"id"=>"17413"}
  Current user: admin (id=1)
  Rendered issues/_action_menu.html.erb (5.6ms)
  Rendered plugins/redmine_contacts/app/views/deals_issues/_show.html.erb (2.5ms)
  Rendered plugins/redmine_contacts_helpdesk/app/views/issues/_ticket_data.html.erb (0.1ms)
  Rendered attachments/_links.html.erb (10.4ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (5.7ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (4.3ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (15.5ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (5.2ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (4.4ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (4.4ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (4.5ms)
  Rendered plugins/redmine_issue_checklist/app/views/issue_checklists/_checklist_item.html.erb (4.5ms)
  Rendered plugins/redmine_issue_checklist/app/views/issues/_checklist.html.erb (55.5ms)
  Rendered plugins/redmine_spent_time_in_issue_description/app/views/issues/_time_spent_report.html.erb (4.8ms)
  Rendered plugins/redmine_spent_time_in_issue_description/app/views/issues/show.html.erb within layouts/base (133.2ms)
Completed 500 Internal Server Error in 348.5ms

ActionView::Template::Error (undefined method `is_spent_on_shown' on an instance of #<Class:0x78c9c>.):
    15:   <tbody>
    16:     <% @issue.time_entries.last( Setting.plugin_redmine_spent_time_in_issue_description['spent_time_max_display'].to_i ).each do |entry| %>
    17:       <tr>
    18:         <%= content_tag(:td, entry.spent_on.strftime("%m/%d/%Y") ) if is_spent_on_shown( entry ) %>
    19:         <%= content_tag(:td, link_to_user( entry.user )) if is_user_shown( entry ) %>
    20:         <%= content_tag(:td, report_time_spent( entry ) ) if is_report_time_shown( entry ) %>
    21:         <%= content_tag(:td, entry.comments ) if is_comment_shown( entry ) %>
  app/controllers/issues_controller.rb:128:in `show'
  app/controllers/issues_controller.rb:125:in `show'
TravisSpangle commented 9 years ago

Thanks for reporting. This is happening because the helper module isn't being installed. I assume your env. is the same you reported in #12. I'll see if I can reproduce it.

frconil commented 9 years ago

CHeers.

Let me know if you need additional debug info.

FrancoisMean commented 9 years ago

Hi same error for me too.

TravisSpangle commented 9 years ago

I'm unable to reproduce the error using the same version of Redmine & Ruby. So theres something else about your environment, configuration, or data.


If it cannot find the method is_spent_on_shown then it's not loading the helper.

Is anyone experiencing this problem comfortable working with Ruby? Please try the below steps and let me know what you get:

  1. Open this file in your editor: ./plugins/redmine_spent_time_in_issue_description/init.rb
  2. On line 21 include the text: raise "Loading IssueHelper"
  3. Save the file and restart your Redmine instance.

You should see the error: /plugins/redmine_spent_time_in_issue_description/init.rb:21:in `block in <top (required)>': Loading IssueHelper (RuntimeError)

This confirms that Rails.configuration is running and should be trying to load the IssueHelper.

frconil commented 9 years ago

As requested:

./rbenvrun.sh rake redmine:plugins:migrate RAILS_ENV=production
rake aborted!
Loading IssueHelper
kernel/common/eval.rb:101:in `instance_exec'
kernel/bootstrap/array.rb:76:in `each'
kernel/common/code_loader.rb:243:in `require'
kernel/common/kernel.rb:705:in `require'
kernel/bootstrap/proc.rb:20:in `call'
kernel/bootstrap/array.rb:76:in `each'
kernel/bootstrap/array.rb:76:in `each'
kernel/bootstrap/array.rb:76:in `each'
kernel/common/kernel.rb:447:in `load'
kernel/delta/code_loader.rb:66:in `load_script'
kernel/delta/code_loader.rb:152:in `load_script'
kernel/loader.rb:649:in `script'
kernel/loader.rb:825:in `main'
Tasks: TOP => redmine:plugins:migrate => environment
(See full trace by running task with --trace)

With --trace:

rake redmine:plugins:migrate RAILS_ENV=production --trace
** Invoke redmine:plugins:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Loading IssueHelper
/var/vhost/dev-redmine/plugins/redmine_spent_time_in_issue_description/init.rb:20:in `__script__'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:517:in `_run__4545443411787390356__prepare__1338411874204908663__callbacks'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `__run_callback'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/application/finisher.rb:47:in `__script__'
kernel/common/eval.rb:101:in `instance_exec'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `run'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/initializable.rb:55:in `run_initializers'
kernel/bootstrap/array.rb:76:in `each'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `run_initializers'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/application.rb:136:in `initialize!'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:in `initialize! (method_missing)'
/var/vhost/dev-redmine/config/environment.rb:14:in `__script__'
kernel/common/code_loader.rb:243:in `require'
kernel/common/kernel.rb:705:in `require'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/application.rb:103:in `require_environment!'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/railties-3.2.19/lib/rails/application.rb:305:in `initialize_tasks'
kernel/bootstrap/proc.rb:20:in `call'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:240:in `execute'
kernel/bootstrap/array.rb:76:in `each'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:179:in `invoke_with_call_chain'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rubysl-monitor-2.0.0/lib/rubysl/monitor/monitor.rb:211:in `synchronize (mon_synchronize)'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:201:in `invoke_prerequisites'
kernel/bootstrap/array.rb:76:in `each'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:199:in `invoke_prerequisites'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:178:in `invoke_with_call_chain'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rubysl-monitor-2.0.0/lib/rubysl/monitor/monitor.rb:211:in `synchronize (mon_synchronize)'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:106:in `top_level'
kernel/bootstrap/array.rb:76:in `each'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:106:in `top_level'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:78:in `run'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/gems/gems/rake-10.3.2/bin/rake:33:in `__script__'
kernel/common/kernel.rb:447:in `load'
/var/vhost/dev-redmine/.rbenv/versions/rbx-2.2.9/bin/rake:23:in `__script__'
kernel/delta/code_loader.rb:66:in `load_script'
kernel/delta/code_loader.rb:152:in `load_script'
kernel/loader.rb:649:in `script'
kernel/loader.rb:825:in `main'
Tasks: TOP => redmine:plugins:migrate => environment
frconil commented 9 years ago

And the modified code tidbit:

Rails.configuration.to_prepare do
    require_dependency 'issue_helper_patch'
    IssuesHelper.send     :include, IssuesHelperPatch
end
raise "Loading IssueHelper"

and the result when restarting redmine:

Puma starting in single mode...
* Version 2.9.1 (rbx 2.1.0), codename: Team High Five
* Min threads: 8, max threads: 16
* Environment: production
! Unable to load application
Loading IssueHelper
TravisSpangle commented 9 years ago

I apologize it should have been in line 20 - inside the Rails.configuration call. I'm curious if that is running or not.

Are you able to reproduce this error from a fresh install of Redmine? No other plugins, default data, etc.

frconil commented 9 years ago

i tried both with the exact same result. I can try to load a default db to see if it still is an issue on a blank db.

frconil commented 9 years ago

OK, the plugin works in a default DB (using load_default_data) with no other plugins.

I'll try adding the plugins we have one by one until I find the one that is causing problems.

frconil commented 9 years ago

I found that the redmine_contacts ( http://www.redmine.org/plugins/redmine_contacts ) plugin is the one that prevents time_spent_in_description working.

Installing it triggers the issue. Subsequently removing it resolves it.

I'll see if I can figure what's causing it.

TravisSpangle commented 9 years ago

That link led me to http://redminecrm.com/projects/crm/pages/1. I downloaded and installed it from the Free Download link. No problems found but that may be from not actually using the plugin, just installing it.

If a plugin overrides issue show like mine does ( has app/views/issues/show.html.erb ) then it would cause a conflict.

frconil commented 9 years ago

Hi,

I don't think it overrides the issues views but I could be wrong:

plugins  # find . -name "show.html.erb" -print
./redmine_contacts_helpdesk/app/views/helpdesk/show.html.erb
./redmine_contacts_helpdesk/app/views/public_tickets/show.html.erb
./redmine_contacts/app/views/deals/show.html.erb
./redmine_contacts/app/views/notes/show.html.erb
./redmine_contacts/app/views/contacts/show.html.erb
./redmine_agile/app/views/agile_charts/show.html.erb
FrancoisMean commented 9 years ago

I am using issue check list, I think it overrides issue

TravisSpangle commented 9 years ago

FrancoisMean are you refering to http://redminecrm.com/projects/checklist/pages/1?

They do not override the show.html.erb

FrancoisMean commented 9 years ago

Need to check but I think it is this one https://github.com/Undev/redmine_issue_checklist

The one from redminecrm is not compatible with the issue template plugin.

TravisSpangle commented 9 years ago

That doesn't override the show.html.erb page either. Look for ./app/views/issues/show.html.erb

FrancoisMean commented 9 years ago

None of my installed plugins override issues :(

TravisSpangle commented 9 years ago

Start with a fresh install of Redmine with default data/settings. Install the plugin and confirm that its working as expected. Then make it like your production instance step-by-step checking for success/failure.

When the plugin stops working it's indicating your previous step is where the conflict is happening.

shuozhifenxi commented 9 years ago

I have the same issue.

It seems that the redmine_checklist plugin somehow has some problem with this plugin. (Maybe the both tried to chage the default issue function?)

I really love the ideas of the both plugins, and I hope they can work togother.

TravisSpangle commented 9 years ago

Good news is that I'm able to reproduce the error with https://github.com/Undev/redmine_issue_checklist and Redmine 2.6 with the redmine_spent_time_in_issue_description plugin.

shuozhifenxi commented 9 years ago

So could you tell us what is the cause of this error please?

TravisSpangle commented 9 years ago

The error stops when I remove lines 21-23 of redmine_issue_checklist/patches/issues_controller_patch.rb. Specifically it's the IssuesController variable that triggers it.

The current guess is that I implemented the issue helper module as a patch when I should have just included into the controller.

TravisSpangle commented 9 years ago

I think I've got it fixed now. Would someone mind confirming so I can close this issue?

Pierstoval commented 9 years ago

I'm gonna test this next week-end, I don't have ssh access to my server from work ;)

Pierstoval commented 9 years ago

No problem for me, works fine :+1:

jansor commented 9 years ago

I have the same issue under redmine 2.5.3. Is this the same problem? how can i resolve it? Edit: I have upgrade our redmine to v2.6.3, uninstall the plugin and install again. still the same issue. when no time is added yet it does display the issue