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

Out Of Memory issue when rendering certain cases of gantt chart #1474

Open
ben-fernandes-sw opened this issue Jun 24, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@ben-fernandes-sw
Copy link

Describe the bug
I experience an OOM error when trying to render certain gantt charts.

I've provided a test case below. The key things to point out are

  • The tickInterval is set as 1day
  • The earliest point of the chart is at 220
  • The latest point of the chart is at 2024-07-15

With this configuration, I think the rendering engine runs into an issue when it tries to create a gantt chart for a timespan this wide, with a tick on every day. It's too much for it to handle, so crashes.

To Reproduce
I suggest doing this in a private window to avoid breaking your main mermaid.live

  1. Paste this into the live editor https://mermaid.live/:
gantt
    tickInterval 1day
    Step A :2024-07-15, 3d
    Step B :220, 1d
  1. See that the editor/browser tab freezes
  2. Navigate to https://mermaid.live/ again
  3. See that the editor is once again frozen (this proves that the data was successfully stored into local storage - on trying to read and display, the browser freezes again)

Expected behavior
The editor should not freeze - I should get some sort of error.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11 23H2
  • Mermaid version: Mermaidv10.9.1 Live Editor
  • Browser and Version: (have tested on all of the below in a private window)
    • Chrome 126.0.6478.115
    • Edge 126.0.2592.68
    • Firefox 127.0.1

Additional context
The main issue here is that I was editing something in the live editor, then it froze up leaving me unable to access my work. Because the tab was frozen whenever I went back to mermaid.live (due to the reloading from local storage), I was also unable to open up dev tools. To get my work back, I had to take the URL and reverse-engineer the compression by looking at the Mermaid source code. Ideally, users shouldn't have to do this. I suggest:

  • Adding an upper bound to what the live editor is willing to render
  • Adding some sort of error boundary so that the tab isn't crashed
  • Modify the URL/local storage saving behaviour so that it's possible to recover data, even if the tab keeps crashing
@ben-fernandes-sw ben-fernandes-sw added the bug Something isn't working label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant