Project

Profile

Help

Bug #4966

closed

Detecting circular dependencies among accumulators

Added by Michael Kay about 3 years ago. Updated almost 3 years ago.

Status:
Closed
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:
Platforms:

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.

Actions #1

Updated by Michael Kay about 3 years ago

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

Actions #2

Updated by Michael Kay about 3 years 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.

Actions #3

Updated by Michael Kay almost 3 years ago

  • Status changed from New to Closed

Decided to make no change to the 10.x as the problem is asymptomatic in the issued product.

Please register to edit this issue

Also available in: Atom PDF