hakimel / reveal.js

The HTML Presentation Framework
https://revealjs.com
MIT License
67.85k stars 16.64k forks source link

Crashing due to reaching heap size limit #3460

Open shree675 opened 1 year ago

shree675 commented 1 year ago

The npm process constantly crashes upon making changes in the files and hot reloading. Here are the logs:

[13:59:21] Starting 'reload'...

<--- Last few GCs --->

[3840:000001304D0D21B0]  3675609 ms: Mark-sweep (reduce) 2045.8 (2079.7) -> 2045.0 (2080.0) MB, 7477.9 / 79.0 ms  (average mu = 0.166, current mu = 0.003) allocation failure scavenge might not succeed
[3840:000001304D0D21B0]  3680399 ms: Mark-sweep (reduce) 2046.1 (2080.0) -> 2045.4 (2080.5) MB, 4776.9 / 100.1 ms  (average mu = 0.102, current mu = 0.003) allocation failure scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF62CEE401F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+112511
 2: 00007FF62CE73146 DSA_meth_get_flags+65542
 3: 00007FF62CE73FFD node::OnFatalError+301
 4: 00007FF62D7A5ADE v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF62D79000D v8::SharedArrayBuffer::Externalize+781
 6: 00007FF62D6335FC v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
 7: 00007FF62D630734 v8::internal::Heap::CollectGarbage+4244
 8: 00007FF62D62E0B0 v8::internal::Heap::AllocateExternalBackingStore+2000
 9: 00007FF62D6529E6 v8::internal::Factory::NewFillerObject+214
10: 00007FF62D385C25 v8::internal::DateCache::Weekday+1797
11: 00007FF62D8334B1 v8::internal::SetupIsolateDelegate::SetupHeap+494417
12: 000001304EDB4E54

These constant crashes are making it difficult for me to use this framework continuously.

t-fritsch commented 1 year ago

Hi @shree675, thank you for the report

I'm not on windows 10 but maybe a few other details could help people who are on this OS to help you :

shree675 commented 1 year ago

@t-fritsch Sure.

  1. I cloned the repository and followed the steps given in the full setup.
  2. No, the problem occurs when I put my custom slides, when I make changes and save the files.
  3. It does not really behave in that manner. Let me elaborate the issue. Every time I start using npm start, it runs fine and the changes I make in the files are reflected in real time. But after a while, like 15 minutes or so, the file saves (I mean, using Ctrl+S) will fail to reload the webpage. It gets stuck for a while and then the above message about heap size appears. When I restart using npm start, the application runs fine and again the same problem occurs after a while. This happens in a cycle.
  4. Not sure about that, will try upgrading my node version and check later. Since it was mentioned in the documentation that node 10.0.0 and later are supported, I thought 16.13.2 would not cause any problems.
t-fritsch commented 1 year ago

thanks for the details 👍 For information I'm not the owner here, just trying to help because I like this tool 🙂

  1. Good !

  2. & 3. : So it may be related to your specific content. I was asking about your config / slides because if it doesn't happen on a blank project (even after 15minutes) maybe providing your files could help others to pinpoint the problem.

  3. : I'm not saying that node 16 is not supported, you're apparently the first to submit an issue with it, so it looks like it may work fine in certain cases. I was suggesting you upgrade your version to see if this issue is node related or reveal related (but yes, I think using dead versions of software is never a good idea 😅 )

shree675 commented 1 year ago

@t-fritsch I would love to provide my files, but the slides contain some contents that I do not want to disclose outside my project organization. But here is my presentation config (in index.html):

<script>
      Reveal.initialize({
        hash: true,
        backgroundTransition: "slide",
        pdfSeparateFragments: true,
        center: true,
        width: 1020,
        plugins: [
          RevealMarkdown,
          RevealHighlight,
          RevealNotes,
          RevealMath.KaTeX,
        ],
      });
      Reveal.on("fragmentshown", (event) => {
        if (
          event.fragment.getAttribute("data-fragment-index") === "4" &&
          event.fragment.getAttribute("id") === "types"
        ) {
          document.getElementById("highlight-0").style.color = "blue";
          document.getElementById("highlight-0").style.fontWeight = "bold";
        } else {
          document.getElementById("highlight-0").style.color = "black";
          document.getElementById("highlight-0").style.fontWeight = "normal";
        }
      });
</script>

And you are right about the last point, I will upgrade my node version and check.

t-fritsch commented 1 year ago

I understand for confidentiality about your slides, please let us know if your tests with upgraded version of node fixes the problem or not

If not, maybe you could try by making a new presentation similar to your presentation but without any sensitive data inside, and see if the problem still happen. If it is the case, I could make a good starting point to help solving your issue 👍