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

Mermaid diagram to pdf lead to Segmentation fault #11066

Open
lrrichter opened this issue Oct 15, 2024 · 11 comments
Open

Mermaid diagram to pdf lead to Segmentation fault #11066

lrrichter opened this issue Oct 15, 2024 · 11 comments
Labels
bug Something isn't working needs-repro Issues that are blocked until reporter provides an adequate reproduction

Comments

@lrrichter
Copy link

Bug description

Rendering of a Mermaid diagram to pdf leads to a segmentation fault in line 192.
Because of the ANSI color code problem (https://github.com/quarto-dev/quarto-cli/pull/10910/files) I had to use the version directly from the git repo (commit 46cdcc3).

Steps to reproduce

````qmd
---
title: "Mermaid Test"
subtitle: "mermaid"
author: "Lothar R"
date: "2024/10/14"
execute:
  echo: true
  error: true
format:
#   html:
#     code-fold: true 
  beamer: 
    aspectratio: 169
    navigation: horizontal
    # theme: tum
    # echo: true
    # highlight-style: gruvbox-dark
    # code-overflow: wrap
    code-line-numbers: true
---



## MWE

```{mermaid}
%%| fig-width: 5.5
%%| echo: false
flowchart TB
    A[(Data Types)]
    A --> B(Boolean Type)
    A --> C(None Type)

```
````

Expected behavior

Render the diagram to pdf

Actual behavior

Rendering to pdf stopped with segmentation fault. Rendering to html works.
quarto render mermaid.qmd --verbose
/usr/local/bin/quarto: Zeile 192: 52556 Segmentation fault: 11 "${QUARTO_DENO}" ${QUARTO_ACTION} ${QUARTO_DENO_OPTIONS} ${QUARTO_DENO_EXTRA_OPTIONS} "${QUARTO_IMPORT_MAP_ARG}" "${QUARTO_TARGET}" "$@"

Your environment

  • OS macOS Sonoma 14.6.1
  • zsh 5.9 and as well
  • VSCode Version: 1.94.2 (Universal)
    Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
    Datum: 2024-10-09T16:08:44.566Z
    Electron: 30.5.1
    ElectronBuildId: 10262041
    Chromium: 124.0.6367.243
    Node.js: 20.16.0
    V8: 12.4.254.20-electron.0
    Betriebssystem: Darwin x64 23.6.0
  • Quarto extension: v1.116.0

Quarto check output

quarto check
Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: 46cdcc35dd3515f8509bd2b8080575b18eb7d350
      Path: /Users/richter/work/tmp/quarto-cli/package/dist/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.20 (Conda)
      Path: /Users/richter/opt/anaconda3/bin/python
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
@lrrichter lrrichter added the bug Something isn't working label Oct 15, 2024
@mcanouil
Copy link
Collaborator

Because of the ANSI color code problem (https://github.com/quarto-dev/quarto-cli/pull/10910/files) I had to use the version directly from the git repo (commit 46cdcc3).

Sorry, it's confusing. What version of Quarto produces the issue?

@lrrichter
Copy link
Author

lrrichter commented Oct 15, 2024

The current (yesterday evening) version from the repo (I gave the commit ID). Sorry, it is my first time that I file a bug.

@mcanouil
Copy link
Collaborator

No reason, to apologise. I only wanted to clarify if the bug was before or after you were using the development version.
Note that, there are pre-releases which are a bit "safer" to use and easier to install.

@mcanouil
Copy link
Collaborator

mcanouil commented Oct 15, 2024

Would you mind trying to remove the unnecessary options?

---
title: "Quarto Playground"
format: beamer
---

## Slide 1

```{mermaid}
flowchart TB
    A[(Data Types)]
    A --> B(Boolean Type)
    A --> C(None Type)
```

I cannot reproduce on almost the same apparent setup (I'm on macOS Sequoia though).
Another difference is that I am using TinyTex as recommended by Quarto (https://quarto.org/docs/output-formats/pdf-engine.html).

What version of Chrome (or similar) are you using?

@mcanouil mcanouil added the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Oct 15, 2024
@lrrichter
Copy link
Author

I get the same result with your example given above.
I use a fresh install of MacTex 2024 (installed yesterday) incl. updates via the TeX Live Utility
Chrome: Version 129.0.6668.101 (Offizieller Build) (x86_64)
I will try to install TinyTex as well.
BTW: Rendering of Python code with syntax highlighted to pdf works well with this version of Quarto.

@mcanouil
Copy link
Collaborator

I will try to install TinyTex as well.

Thanks!

BTW: Rendering of Python code with syntax highlighted to pdf works well with this version of Quarto.

Likely a Pandoc/Skylighting update in that regards.

@mcanouil mcanouil added the latex LaTeX engines related libraries and technologies label Oct 15, 2024
@cderv
Copy link
Collaborator

cderv commented Oct 15, 2024

Because of the ANSI color code problem (https://github.com/quarto-dev/quarto-cli/pull/10910/files) I had to use the version directly from the git repo (commit 46cdcc3).

@lrrichter #10910 has been merged and available in 1.6.15 pre-release. You could use built pre-release to have it working if you don't want to bother with dev version with install from git.

This would also make sure that there is no side effect of configuration of the dev version.

/usr/local/bin/quarto: Zeile 192: 52556 Segmentation fault: 11 "${QUARTO_DENO}" ${QUARTO_ACTION} ${QUARTO_DENO_OPTIONS} ${QUARTO_DENO_EXTRA_OPTIONS} "${QUARTO_IMPORT_MAP_ARG}" "${QUARTO_TARGET}" "$@"

The error is not thrown by LaTeX rendering. It seems to be at Quarto level. Let's keep investigating !

Using mermaid for PDF output means that snapshoting using chrome will happen to make a version of the mermaid.js content available to LaTeX for PDF rendering.

If you have issue only with files using mermaid cells, then it could be linked to this processing.

Is this Segmentation Fault error happening with other type of rendering ?

Also can you activate debug logging : https://quarto.org/docs/troubleshooting/#verbose-mode
Do you have a stack trace showing already ? Otherwise: https://quarto.org/docs/troubleshooting/#get-a-stack-trace

Thank you.

@cderv cderv removed the latex LaTeX engines related libraries and technologies label Oct 15, 2024
@lrrichter
Copy link
Author

lrrichter commented Oct 15, 2024

I have done the following:

  • installed the pre-release version, so I have 1.6.25
  • I have installed tinytex installed using wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh to /usr/local/bin
  • I have set this in my shell environment:
    QUARTO_LOG_LEVEL=DEBUG
    QUARTO_PRINT_STACK=true
  • The example from (Mermaid diagram to pdf lead to Segmentation fault #11066 (comment)) compile to html output but not to pdf.
  • I tried on the command line : quarto render quartoplayground.qmd
    +output: Quarto version: 1.6.25
    /usr/local/bin/quarto: Zeile 192: 39223 Segmentation fault: 11 "${QUARTO_DENO}" ${QUARTO_ACTION} ${QUARTO_DENO_OPTIONS} ${QUARTO_DENO_EXTRA_OPTIONS} "${QUARTO_IMPORT_MAP_ARG}" "${QUARTO_TARGET}" "$@"
  • log files (in Application Support/quarto/logs) are empty:
    drwxr-xr-x 3 richter staff 96 15 Okt 12:30 .
    drwxr-xr-x 4 richter staff 128 13 Okt 2022 ..
    -rw-r--r-- 1 richter staff 0 15 Okt 12:30 jupyter-kernel.log

Do you want the (now lengthy) full quarto check output?

@cderv
Copy link
Collaborator

cderv commented Oct 15, 2024

Thanks a lot !

It would be really helpful if you could you try 1.6.18 and 1.6.19 ?
Quarto 1.6.18 is when we updated to Deno 1.46.3 and it seems the Segmentation Fault is thown from Quarto script when calling Deno. So I suspect the update could be related...

Can you confirm this is only when having mermaid cell in your document that it fails ? Which would confirm that our processing for snapshoting with chrome could be involved.

@lrrichter
Copy link
Author

Thanks for the advice. I will give it a try. Only how/where can I get Quarto version 1.6.18 and 1.6.19. I cannot see them on the pre-release builds page. If you could give me the concise git command I would try it.
Regular text and Python compiles well to pdf. Some chapters down the road also contain dot, but I have not come so far.

@mcanouil
Copy link
Collaborator

All releases are on GitHub: https://github.com/quarto-dev/quarto-cli/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-repro Issues that are blocked until reporter provides an adequate reproduction
Projects
None yet
Development

No branches or pull requests

3 participants