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

Manuskript runs amok, with Project (Project is added) #729

Closed
obw opened this issue Jan 29, 2020 · 4 comments · Fixed by #901
Closed

Manuskript runs amok, with Project (Project is added) #729

obw opened this issue Jan 29, 2020 · 4 comments · Fixed by #901
Labels
Milestone

Comments

@obw
Copy link
Contributor

obw commented Jan 29, 2020

I have started #726 and copied what we have from the Wiki and so on.

But after I added the source installation descriptions, Manuskript eat up all my RAM (16GB of real and 32GB of swap under Linux)!
Zipped Projectfile: manuskript_doc.zip

It's the latest development Version, updated Sunday 26.01.2020 (DD.MM.YYYY).

Additional Info:

  • Python 3.6.9
  • PyQt 5.13.1
  • Qt 5.13.0

The Problem is the text of the Windows Source installation. Well it looks like, when I make this part/scene empty Manuskript just works fine.

@worstje
Copy link
Contributor

worstje commented Jan 29, 2020

I was able to reproduce this on Windows. Let me see what I can figure out.

Edit:

From my tests, it looks to be an issue with ui/views/MDEditView.py's implementation of getClickRects() on line 464. I haven't figured out the exact cause yet (I am sleepy and there's a lot of variables with no comments going on) but if anyone needs a no-freeze workaround they can just temporarily replace that method with a stub that does nothing.

@worstje
Copy link
Contributor

worstje commented Jan 29, 2020

I have identified the cause of the bug that causes the hang. Submitting a patch isn't too difficult; my problem is mostly in not being sure what actually causes the bug to begin with.

The bug is caused by cursor.moveCursor(cursor.Down) returning false, a condition that we never check succeeds in this function. Clearly, it works fine most of the time... but not here! The specific call that causes the error is the one at the bottom of the while self.cursorRect(cursor).top() != r2.top(): loop.

Even more interesting is the fact that, if you have the text opened up from last time when you start Manuskript, the call succeeds... but if you switch to a different text and go back, processing exactly the same document will suddenly cause it to hang. What is it that causes it to act differently?!

For the time being, adjusting the inner-most while loop in question like this seems to fix the behaviour for as far my limited tests have been able to ascertain:

while self.cursorRect(cursor).top() != r2.top():
    r3 = self.cursorRect(cursor)
    r3.setLeft(self.viewport().geometry().left())
    r3.setRight(self.viewport().geometry().right())
    refs.append(ClickThing(r3, rx, rx.capturedTexts()))
    if not cursor.movePosition(cursor.Down):
        print("Failed to move cursor down. Break break break!")
        break

Regardless of whether someone can identify the reason for the behaviour, I do feel like adding comments and including debugging notices for weird failures like these would be useful to have in order to better understand the workings of this and other code as we move forward. (But I am a bit worried about adding them in the current build since we have enough print() spam as it is.)

@obw
Copy link
Contributor Author

obw commented Feb 3, 2020

@worstje: I have just added your Quickfix, it's working thanks!

@DarkRedman
Copy link
Contributor

I'm confused, what is Amok and how is it related to the Display images bug ?! I was thinking it could be Qt not handling bounding box for text overlay ?!

worstje added a commit to worstje/manuskript that referenced this issue Jul 10, 2021
A long time ago, I identified this failure but wasn't sure why it was
failing. I still don't know why, but the emergency fix at least prevents
other people from running into it. As a bonus, since we have a proper
logging facility now, we can actually log it as I desired to do back
then!

This commit tentatively fixes issue 729.
worstje added a commit to worstje/manuskript that referenced this issue Jul 10, 2021
A long time ago, I identified this failure but wasn't sure why it was
failing. I still don't know why, but the emergency fix at least prevents
other people from running into it. As a bonus, since we have a proper
logging facility now, we can actually log it as I desired to do back
then!

This commit tentatively fixes issue 729.
@TheJackiMonster TheJackiMonster added this to the 0.13.0 milestone Jul 10, 2021
@TheJackiMonster TheJackiMonster linked a pull request Jul 10, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants