Bug 48397 - [PATCH] infinite loop in footnotes (see also #47424)
Summary: [PATCH] infinite loop in footnotes (see also #47424)
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: page-master/layout (show other bugs)
Version: trunk
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-16 05:38 UTC by Heidi Vanparys
Modified: 2012-04-11 03:20 UTC (History)
0 users



Attachments
Patch for #47424 (206.31 KB, application/octet-stream)
2009-12-16 05:38 UTC, Heidi Vanparys
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Heidi Vanparys 2009-12-16 05:38:00 UTC
Created attachment 24712 [details]
Patch for #47424

This patch solves the problem of an infinite loop in footnotes as reported in bug 47424.

The infinite loop occurred in org.apache.fop.layoutmgr.PageBreakingAlgorithm.getFootnoteSplit(int, int, int, int, boolean).

This patch does not solve the problem of another infinite loop in footnotes as reported in bugs 48063 and 48162. This infinite loop occurs in org.apache.fop.layoutmgr.PageBreakingAlgorithm.createFootnotePages(KnuthPageNode). The test attached to 48063 is converted to a testcase and added to the list of disabled testcases.
Comment 1 Vincent Hennebert 2009-12-17 04:19:26 UTC
Hi Heidi,

Thanks for your patch. Although I'm afraid it's more of a workaround than an actual fix for the issue. Not that it's useless, it may actually help people who run into this issue and need a quick temporary solution. But I'm not sure we want it to be integrated into the code.

I acknowledge that page breaking is not the simplest piece of code, but it would be good to identify the origin of the error. From a quick debugging session that I made some time ago, I noticed errors in the PageBreakingAlgorithm.restartFrom method: some footnote-related variables are not properly reset, which means that when getFootnoteSplit is called it's believed to be more footnote content than there actually is. The problem may lie there.

Creating a simple test case is key to help the debugging. I would try to create an FO file that is just a few lines high, with no side region (region-before, -after, etc.) and specify every dimension in points (to have more 'even' values in the debugger). Then, define the page height such that the content doesn't exactly fit (for example, 105pt high with lines of 10pt), which will trigger the call to the restartFrom method, and start debugging from there. The second attachment to bug 47424 may actually be a good start.

ATM I don't have much time to look into this issue in more detail unfortunately. I hope those few notes will help you get started if you want to have a go at it. Meanwhile, your patch will be helpful to people in urgent need for a workaround.


Thanks,
Vincent


(In reply to comment #0)
> Created an attachment (id=24712) [details]
> Patch for #47424
> 
> This patch solves the problem of an infinite loop in footnotes as reported in
> bug 47424.
> 
> The infinite loop occurred in
> org.apache.fop.layoutmgr.PageBreakingAlgorithm.getFootnoteSplit(int, int, int,
> int, boolean).
> 
> This patch does not solve the problem of another infinite loop in footnotes as
> reported in bugs 48063 and 48162. This infinite loop occurs in
> org.apache.fop.layoutmgr.PageBreakingAlgorithm.createFootnotePages(KnuthPageNode).
> The test attached to 48063 is converted to a testcase and added to the list of
> disabled testcases.
Comment 2 Glenn Adams 2012-04-07 01:41:23 UTC
resetting P2 open bugs to P3 pending further review
Comment 3 Glenn Adams 2012-04-11 03:20:25 UTC
increase priority for bugs with a patch