Project

Profile

Help

Bug #4966

Detecting circular dependencies among accumulators

Added by Michael Kay about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2021-04-13
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10, trunk
Fix Committed on Branch:
trunk
Fixed in Maintenance Release:

Description

The logic for detecting circularities among accumulators appears to be flawed.

Test accumulator-080 tests this condition, and we pass the test by catching a StackOverflowError in AccumulatorData.visit(). But it's not possible to catch a StackOverflow in C#, and this reveals that the other mechanisms which should catch the circularity earlier (long before the StackOverflow occurs) are failing to do so.

Specifically, there are two mechanisms

(a) AccumulatorData.buildIndex() keeps a local flag "building" which should catch any recursive entry into buildIndex() for the same AccumulatorData object. But this achieves nothing because we're creating a new AccumulatorData object on each recursive entry.

(b) AccumulatorManager.getAccumulatorData() keeps (for each document) a map from accumulator declarations to accumulator data objects, and the logic is designed to place a MARKER in this map while the accumulator data is under construction. But the code to place this MARKER in the map doesn't get executed on the path where the map exists, but doesn't hold an entry for the relevant accumulator: that is, the MARKER is only set up for the first accumulator that's built for each document.

History

#1 Updated by Michael Kay about 1 month ago

Fixed by moving the line map.put(acc, MARKER); out of the else branch of the conditional (AccumulatorManager.getAccumulatorData())

#2 Updated by Michael Kay about 1 month ago

  • Fix Committed on Branch trunk added

Fixed on the 11.x branch; I'll hold back on 10.x until I'm more confident there's no regression.

Please register to edit this issue

Also available in: Atom PDF