Loriowar / redmine_issues_tree

Provides a tree view of the Redmine issues list
GNU General Public License v3.0
115 stars 72 forks source link

Internal error 500 #15

Closed oruspay closed 8 years ago

oruspay commented 8 years ago

Hello,

After install plugin when I click on Tree View I get an error: Internal error

Environment: Redmine version 3.1.1.stable Ruby version 2.0.0-p645 (2015-04-13) [x86_64-linux] Rails version 4.2.4 Environment production Database adapter Mysql2 SCM: Subversion 1.6.11 Mercurial 1.4 Git 1.8.2.1 Filesystem
Redmine plugins: easy_gantt 2016-RC1.0 redmine_custom_css 0.1.6 redmine_issues_tree 0.0.5 scrum 0.13.1

production.log

...
SELECT DISTINCT `trackers`.* FROM `trackers` INNER JOIN `projects_trackers` ON `projects_trackers`.`tracker_id` = `trackers`.`id` INNER JOIN `projects` ON `projects`.`id` = `projects_trackers`.`project_id` JOIN enabled_modules ON enabled_modules.project_id = projects.id AND enabled_modules.name = 'issue_tracking' WHERE (projects.lft >= 5 AND projects.rgt <= 6 AND projects.status <> 9)  ORDER BY `trackers`.`position` ASC
Completed 500 Internal Server Error in 27ms (ActiveRecord: 4.4ms)

NoMethodError (undefined method `<<' for {}:Hash):
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Loriowar commented 8 years ago

Please, provide full traceback. Current variant is too short for investigation.

oruspay commented 8 years ago

My additional_environment.rb already has:

config.logger = Logger.new('data/log.log', 1, 1000000)
config.logger.level = Logger::DEBUG
config.log_level = :debug

The log.log does not have full traceback, is there any parameter to get it ?

D, [2015-11-10T07:52:44.347062 #224029] DEBUG -- :   IssueCustomField Load (0.3ms)  SELECT `custom_fields`.* FROM `custom_fields` WHERE `custom_fields`.`type` IN ('IssueCustomField') AND (is_for_all = 1 OR id IN (SELECT DISTINCT cfp.custom_field_id FROM custom_fields_projects cfp WHERE cfp.project_id = 7))  ORDER BY `custom_fields`.`position` ASC
D, [2015-11-10T07:52:44.348416 #224029] DEBUG -- :    (0.3ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 7
I, [2015-11-10T07:52:44.350074 #224029]  INFO -- : Completed 500 Internal Server Error in 27ms (ActiveRecord: 5.6ms)
F, [2015-11-10T07:52:44.352001 #224029] FATAL -- : 
NoMethodError (undefined method `<<' for {}:Hash):
  lib/redmine/sudo_mode.rb:63:in `sudo_mode

Thanks,

Loriowar commented 8 years ago

Full stack, usually, appear in development environment. I'll glad to help, but need more information. For now I can't say why this happens.

Loriowar commented 8 years ago

I understood your problem. You try to apply query with grouping from tree view page. This is same problem which described in #14. I try to solve it in closest future. For now you can apply query from plain view and then go to tree view.

Loriowar commented 8 years ago

Hope I fix your problem. Please try repeat this problem using master branch of plugin. If it is ok, I'll add changes in all supported versions.

oruspay commented 8 years ago

Hello Loriowar, thanks for the feedback.

Unfortunately the workaround did not work even cleaning the grouping form.

I also tried to update from repository but got the same error, in the query you can see there is no group_by value:

Started GET "/projects/portal-de-servicos/issues_trees/tree_index?c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&f%5B%5D=&group_by=&project_id=portal-de-servicos&set_filter=1" for 127.2.19.1 at 2015-11-16 06:03:27 -0500
Processing by IssuesTreesController#tree_index as HTML
  Parameters: {"c"=>["tracker", "status", "priority", "subject", "assigned_to", "updated_on"], "f"=>[""], "group_by"=>"", "project_id"=>"portal-de-servicos", "set_filter"=>"1"}
   (10.4ms)  SELECT MAX(`settings`.`updated_on`) FROM `settings`
  User Load (2.1ms)  SELECT  `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 5 LIMIT 1
  Current user: ricardo.marques (id=5)
  Project Load (0.3ms)  SELECT  `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'portal-de-servicos'  ORDER BY `projects`.`id` ASC LIMIT 1
  IssueCustomField Load (1.3ms)  SELECT `custom_fields`.* FROM `custom_fields` WHERE `custom_fields`.`type` IN ('IssueCustomField') AND (is_for_all = 1 OR id IN (SELECT DISTINCT cfp.custom_field_id FROM custom_fields_projects cfp WHERE cfp.project_id = 7))  ORDER BY `custom_fields`.`position` ASC
   (6.4ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 7
  Tracker Load (1.5ms)  SELECT DISTINCT `trackers`.* FROM `trackers` INNER JOIN `projects_trackers` ON `projects_trackers`.`tracker_id` = `trackers`.`id` INNER JOIN `projects` ON `projects`.`id` = `projects_trackers`.`project_id` JOIN enabled_modules ON enabled_modules.project_id = projects.id AND enabled_modules.name = 'issue_tracking' WHERE (projects.lft >= 7 AND projects.rgt <= 8 AND projects.status <> 9)  ORDER BY `trackers`.`position` ASC
Completed 500 Internal Server Error in 37ms (ActiveRecord: 22.0ms)

NoMethodError (undefined method `<<' for {}:Hash):
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'
oruspay commented 8 years ago

Loriowar, finally I got full trace and found out the problem:

plugins/scrum/lib/scrum/issue_query_patch.rb:40:in `issues_with_scrum'
plugins/redmine_issues_tree/app/controllers/issues_trees_controller.rb:39:in `tree_index'
actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in `process_action'

The plugin SCRUM seems to be incompatible with issues_tree, I removed it and all worked fine.

I have two suggestions, create compability to SCRUM plugin once it is very used. Create something visual for related issues like you do in parent-child issues.

Thank you !

Loriowar commented 8 years ago

Thanks for mention about compatibility. I'll investigate this ability and try to fix a problem. Hope, you understand, what I can't make a plugin compatible with all other plugin at once. But I'll be glad to fix this problem and make a plugin better.

ffarzat commented 8 years ago

News about the fix?

Loriowar commented 8 years ago

Sorry, nothing new. Now I very busy and haven't a time for improving this plugin. But I remember about all bugs and requested features. So I will add a compatibility with "scrum" plugin, but I don't know when it happens.

ffarzat commented 8 years ago

To solve the incompatibility go to plugins/scrum/lib/scrum/issue_query_patch.rb and modify lines 37 and 47. Replace options[:include] ||= {} by options[:include] ||= []. Thats solved the problem for me. Both plugins are functional in my enviroment.

And yes: its a temp fix. I hope it helps.

cristiar1000 commented 6 years ago

@ffarzat, I have applied your suggestion and it worked. Thank you @ffarzat!