SlidePilot / SlidePilot-macOS

Ultimate PDF Presentation Tool for macOS 🖥
https://slidepilotapp.com
GNU General Public License v3.0
156 stars 5 forks source link

Segfault on refreshing big files #42

Closed jacquesdurden closed 4 years ago

jacquesdurden commented 4 years ago

Bug description

I have a big PDF (more than 400 slides, 13 Mb) that is generated by the compilation of a latex/beamer file, with "latexmk" running in the background.

When the PDF document is updated after compilation (actually, it's always compiled two times, to get references right, and thus the PDF is refreshed twice within a 10s period), SlidePilot detects the document change, tries to refresh it and then it just crashes.

I'm wondering if the refreshing process is robust enough if the PDF file is big as here. Maybe SlidePilot tries to reload it while it is under modification, or something (sorry I'm not expert).

Steps to reproduce

See above.

Expected behavior

Actual behavior

Details

Screenshots (optional)

brabanod commented 4 years ago

Thanks for reporting the bug. Would you mind providing the PDF or a similar PDF with which you are getting that crash. This would help me to test and debug it.

jacquesdurden commented 4 years ago

Sure, here is a minimal example that crashed SlidePilot on my computer.

Here is the steps to reproduce it, I hope.

1°) Take the file dummy.tex (it's compressed here) dummy.tex.zip

That file contains simply a few hundreds beamer frames with always the same content

\begin{frame}{A frame}
Test
\end{frame}

2°) Compile this file with latexmk launched in the background, that is, it continuously checks for file modifications and recompile the document at each modification (it opens also a pdf viewer that is not SlidePilot but you can remove it)

latexmk -pvc dummy.tex -pdf

3°) Open the compiled dummy.pdf with SlidePilot.

4°) Try adding a few slides

\begin{frame}{A frame}
Test
\end{frame}

in the latex source and save the document. This wakes latexmk that then recompiles the file, refresh the previous PDF, and most often than not, SlidePilot crashes.

I guess this bug is mainly for pretty huge file. Here the document has a few hundreds slides, but if the slides a more filled, SlidePilot crashed for lesser pages.

I hope you'll be able to reproduce this.

Note: I was able to reproduce the crash with just pdflatex, but the crash is more random.

brabanod commented 4 years ago

Ok, I managed to compile the dummy.tex, but I could not experience a crash. How long is your compile time? For me it takes roughly 13 seconds and the PDF is only 397KB big. Can you confirm these values?

I followed your steps:

  1. Open SlidePilot with dummy.pdf
  2. Open the dummy.tex
  3. Start latexmk
  4. Change dummy.tex and save

Then latexmk starts running. After about 13 seconds it is finished and then SlidePilot automatically reloads the document without a crash.

When I do some consecutive changes to dummy.tex and always save them afterwards, it takes latexmk so long to compile, that I am guessing the error just can't occur because SlidePilot has about 13 seconds to load dummy.pdf

Is you compile time maybe shorter?

jacquesdurden commented 4 years ago

Weird.

No the compilation is about the same time for me (Note that latexmk simply uses pdflatex, so it would be the same compilation time for pdflatex alone).

SlidePilot crashes most of the time (50% of times) if I add new slides rather than modifying existing ones. Have you tried also to add a few between two compilations?

Maybe it's a memory issue that is related to the specific configuration of each computer. Could you try to add a few hundreds more slides and see if you get the same crash?

Thank you for your time on this anyway.

brabanod commented 4 years ago

Yes, I did that. Here is my procedure:

  1. Open SlidePilot with dummy.pdf
  2. Open the dummy.tex
  3. Start latexmk
  4. Adding a few slides in dummy.tex and save
  5. latexmk starts running (SlidePilot hasn't reloaded anything yet)
  6. I change something in dummy.tex again and save it
  7. latexmk finishes first run -> SlidePilot reloads
  8. latexmk starts second run
  9. latexmk finishes second run -> SlidePilot reloads

No crashes.

Anyways, I've done some changes to the reloading mechanism. Now it should reload the document asynchronously and cancel loading, when changes occur. Could you try it out and tell me if this fixes the crashes for you?

SlidePilot-1.6.2-beta.zip

jacquesdurden commented 4 years ago

Cool, it works great so far on a 413-slide compilation with tons of pictures, formulas, .... Thank you! The asynchronicity seems to solve the bug.

brabanod commented 4 years ago

Great, I will then close this issue. This fix will be included in the next update.