Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rinohtype enters infinite loop when rendering a tall image #283

Open
alexfargus opened this issue Aug 23, 2021 · 4 comments
Open

rinohtype enters infinite loop when rendering a tall image #283

alexfargus opened this issue Aug 23, 2021 · 4 comments
Labels
bug crash rinohtype aborts due to an uncaught exception priority:high

Comments

@alexfargus
Copy link
Contributor

Trying to render the following .rst with the attached image triggers an infinite loop. I have verified that this issue exists on master.

.. figure:: ./loop.png
    :width: 80%

    This figure triggers an infinite loop while rendering.

loop

I believe that the issue is caused by some combination of the width attribute and the dimensions of the image file. Removing the attribute or changing the image dimensions will work around the issue.

I have tried to find the root cause, but I am having trouble following the rendering logic.

@brechtm can you suggest any tips for figuring out what is going wrong?

@alexfargus alexfargus added bug crash rinohtype aborts due to an uncaught exception labels Aug 23, 2021
@brechtm
Copy link
Owner

brechtm commented Aug 25, 2021

When the image is scaled to 80% of the width, it's height is too large to fit on the page, and rinohtype moves it to the next page where the same thing happens. We need to check whether the image is the first flowable on the page. If it is, we should always place it, even if it exceeds the available height. You can use container.page._empty for this, which is set to False as soon as a flowable has been placed on the page.

@brechtm
Copy link
Owner

brechtm commented Aug 25, 2021

Something similar happens with inline images if they don't fit in the available width (or height, probably).

@brechtm brechtm changed the title rinohtype enters infinite loop during rendering rinohtype enters infinite loop when rendering a tall image Aug 25, 2021
@fdeprey
Copy link

fdeprey commented Feb 11, 2022

@brechtm We had the same issue already several times.

@brechtm
Copy link
Owner

brechtm commented Mar 9, 2022

I had another look at this. This is already handled for images, but not for figures. That possibly requires some redesign, so it might take a while...

brechtm added a commit that referenced this issue Jun 10, 2022
Make Flowable.flow() additionally return whether the flowable was too
tall for the page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crash rinohtype aborts due to an uncaught exception priority:high
Projects
None yet
Development

No branches or pull requests

3 participants