Project

General

Profile

Actions

Bug #4389

closed

[Workbench] Fix infinite loop in ApplicationController#project_breadcrumbs

Added by Tom Clegg over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Workbench
Target version:
Story points:
0.5

Subtasks 2 (0 open2 closed)

Task #4390: Review 4389-breadcrumbs-infinite-loopResolvedTim Pierce11/04/2014Actions
Task #4593: FixResolvedTom Clegg11/04/2014Actions
Actions #1

Updated by Tom Clegg over 9 years ago

4389-breadcrumbs-infinite-loop
Actions #2

Updated by Tom Clegg over 9 years ago

  • Category set to Workbench
  • Status changed from New to In Progress
  • Assigned To set to Tom Clegg
Actions #3

Updated by Tim Pierce over 9 years ago

Review at 8e7d4e83

If we're now ignoring @name_link entirely when producing breadcrumbs, then this code in apps/workbench/app/views/layouts/body.html.erb should be revisited too:

<% if @name_link or @object %>
...
  <% project_breadcrumbs.each do |p| %>

LGTM otherwise, thanks.

Actions #4

Updated by Tom Clegg over 9 years ago

Tim Pierce wrote:

Review at 8e7d4e83

If we're now ignoring @name_link entirely when producing breadcrumbs, then this code in apps/workbench/app/views/layouts/body.html.erb should be revisited too:
[...]

LGTM otherwise, thanks.

Indeed, and there's actually a whole lot more name_link cruft still sitting around that isn't needed after #3036. I'd like to resolve the infinite loop bug without blocking on fixing all that, though, and ignoring @name_link isn't necessary to fix this bug, so I've backed out that part.

Now at 2663cf4 -- look OK?

Actions #5

Updated by Tim Pierce over 9 years ago

Tom Clegg wrote:

Indeed, and there's actually a whole lot more name_link cruft still sitting around that isn't needed after #3036. I'd like to resolve the infinite loop bug without blocking on fixing all that, though, and ignoring @name_link isn't necessary to fix this bug, so I've backed out that part.

Now at 2663cf4 -- look OK?

Focusing on just fixing the infinite loop makes sense to me. In the new change, I think that if @name_link is set, then current.is_a?(Group) will never be true and no breadcrumbs will be created.

If that's acceptable, then go ahead and merge. I'm just checking that we're aware of that exception.

Actions #6

Updated by Tim Pierce over 9 years ago

Review at e4db374

I think I'm getting more confused with each new commit!

current = @name_link.andand.tail_uuid || @object.andand.owner_uuid
while current.is_a?(Group) and current.group_class == 'project'
  ...

After the first line, current will be a string, or nil. It will never pass current.is_a?(Group).

I think this requires running ArvadosBase.find on the uuid that's returned, or does that happen automagically?

Actions #7

Updated by Tom Clegg over 9 years ago

Tim Pierce wrote:

Review at e4db374

I think I'm getting more confused with each new commit!

Me too!

I decided to go back to basics: just detect the infinite loop and halt. 23aea08

Now at e34d685 with master merged.

Actions #8

Updated by Tim Pierce over 9 years ago

OK, this makes sense. Is there an easy way we could construct a test for this? Could we add test fixtures for a circular name link chain and write a functional test for project_breadcrumbs, or will the model constraints reject the circular name chain? (IIRC this is done in the controller rather than the model, but I may be thinking of circular ownership instead.)

Actions #9

Updated by Tom Clegg over 9 years ago

Added test in ed7369d

Actions #10

Updated by Tim Pierce over 9 years ago

Tom Clegg wrote:

Added test in ed7369d

LGTM. Thanks very much.

Actions #11

Updated by Anonymous over 9 years ago

  • Status changed from In Progress to Resolved

Applied in changeset arvados|commit:72cf9a5814e52adb2b6c2f349cbef3de069722bb.

Actions

Also available in: Atom PDF