https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292011-01-15T14:17:34ZRedmineRedmine - Defect #7320: circular dependency >2 issueshttps://www.redmine.org/issues/7320?journal_id=241412011-01-15T14:17:34ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Category</strong> set to <i>Issues</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Target version</strong> set to <i>1.2.0</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><blockquote>
<p>When there is a circular dependency with for example 3 issues (1 duplicates 2 duplicates 3 duplicates 1)</p>
</blockquote>
<p>I'm getting a validation error that prevents the creation of the 3rd relation. But anyway, <a class="changeset" title="Prevent SystemStackError on Issue#all_dependent_issues with circular dependency (#7320)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/4723">r4723</a> fixes Issue#all_dependent_issues in case a circular dependency is present in the database.</p> Redmine - Defect #7320: circular dependency >2 issueshttps://www.redmine.org/issues/7320?journal_id=260392011-03-07T15:13:03ZWill Voelcker
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li></ul><p>Jean-Philippe,</p>
<p>I'm on Redmine 1.0.5 and am seeing this same issue, even after applying the patch you submitted.</p>
<pre>
Processing IssueRelationsController#new (for MYSERVER at 2011-03-07 12:06:58) [POST]
Parameters: {"commit"=>"Add", "issue_id"=>"1537", "action"=>"new", "authenticity_token"=>"PSszsDSp31v945CraOn8XACbzGXmhupl39kUO6GYN3o=", "relation"=>{"delay"=>"", "issue_to_id"=>"1477", "relation_type"=>"blocked"}, "id"=>"1537", "controller"=>"issue_relations"}
SystemStackError (stack level too deep):
app/models/issue.rb:420:in `all_dependent_issues'
app/models/issue.rb:419:in `all_dependent_issues'
app/models/issue.rb:421:in `all_dependent_issues'
.
.
.
app/models/issue.rb:421:in `all_dependent_issues'
app/models/issue.rb:419:in `all_dependent_issues'
app/models/issue_relation.rb:50:in `validate'
app/controllers/issue_relations_controller.rb:27:in `new'
passenger (3.0.2) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.2) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.2) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.2) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
passenger (3.0.2) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
passenger (3.0.2) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.2) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.2) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
passenger (3.0.2) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.2) helper-scripts/passenger-spawn-server:99
Rendering /usr/local/redmine-1.0.5/public/500.html (500 Internal Server Error)
</pre>
<p>I'm new to Ruby, but was able to prevent the error by adapting your patch to keep track of all values of 'relation.issue_to' as well as 'self'. My code follows, but you can probably improve / find many things wrong with it.</p>
<pre>
def all_dependent_issues(except=nil)
if except == nil
except = []
except << self
end
dependencies = []
relations_from.each do |relation|
if relation.issue_to && except.include?(relation.issue_to)
dependencies << relation.issue_to
except << relation.issue_to
dependencies += relation.issue_to.all_dependent_issues(except)
end
end
dependencies
end
</pre> Redmine - Defect #7320: circular dependency >2 issueshttps://www.redmine.org/issues/7320?journal_id=260412011-03-07T15:22:37ZWill Voelcker
<ul></ul><p>Sorry, I think there ought to be a ! before except.include?(relation.issue_to) - but I'll leave this with you. New code:</p>
<pre>
def all_dependent_issues(except=nil)
if except == nil
except = []
except << self
end
dependencies = []
relations_from.each do |relation|
if relation.issue_to && !except.include?(relation.issue_to)
dependencies << relation.issue_to
except << relation.issue_to
dependencies += relation.issue_to.all_dependent_issues(except)
end
end
dependencies
end
</pre> Redmine - Defect #7320: circular dependency >2 issueshttps://www.redmine.org/issues/7320?journal_id=263282011-03-13T13:01:32ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>Reopened</i> to <i>Closed</i></li></ul><p>Fix and test committed in <a class="changeset" title="Prevent SystemStackError on Issue#all_dependent_issues with mutiple circular dependencies (#7320)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/5104">r5104</a>.</p>