Skip to content

Hang then error when rending Mermaid graph to PDF  #3052

@javajon

Description

@javajon

Bug description

Using the latest Quarto with version with latest tools on Windows 11, VSCode:

Quarto: 1.2.242

Tool         Status         Installed     Latest
chromium     Up to date     869685        869685
tinytex      Up to date     v2022.10      v2022.10

In _quarto.yml:

project:
  title: "test"
  output-dir: .output

author: Jonathan Johnson

format:
  revealjs:
    theme: [dark, custom.scss]
    highlight-style: dracula   # arrow
    preview-links: auto
    code-line-numbers: "false"
    transition: convex
    chalkboard: 
      boardmarker-width: 5
    code-copy: true
  pdf:
    toc: true
    number-sections: true
    colorlinks: true
    toc-title: Contents
    highlight-style: github
    # pdf-engine: wkhtmltopdf
    # pdf-engine: xelatex 
from: markdown+emoji
execute:
  echo: false

With this qmd:

---
title: "Test of rendering mermaid to pdf"
---

## Binary Tree

```{mermaid}
%%| fig-width: 5.5
%%{init: {'theme':'dark'}}%%
graph TB
    A((8))-->B((3))
    A-->C((10))
    B-->D((1))
    B-->E((6))
    C-->F((9))
    C-->G((14))
    E-->H((4))
    E-->I((7))

This renders to the HTML, browser with reveal.js, but not to PDF.

It appears the root error is: "Could not load mf.dll:"

Here is the output with the error:

```sh
quarto preview [redacted path]/pdf-render-error.qmd --to pdf --no-browser --no-watch-inputs
ERROR: Couldn't find open server.
Chrome process error: [1026/111558.776:WARNING:resource_bundle.cc(405)] locale_file_path.empty() for locale 
[1026/111558.776:ERROR:resource_bundle.cc(911)] Failed to load C:\Users\jonat\AppData\Local\quarto\chromium\win64-869685\chrome-win\resources.pak
Some features may not be available.
[1026/111558.802:WARNING:headless_browser_main_parts.cc(106)] Cannot create Pref Service with no user data dir.
[1026/111558.803:ERROR:dxva_video_decode_accelerator_win.cc(1406)] DXVAVDA fatal error: Could not load mf.dll: The specified module could not be found. (0x7E)

DevTools listening on ws://127.0.0.1:9222/devtools/browser/50bced1c-1d60-4c43-aadb-f2fe69c062b2
[1026/111558.805:ERROR:gpu_channel_manager.cc(746)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[1026/111558.806:ERROR:shared_image_stub.cc(460)] SharedImageStub: unable to create context
[1026/111558.806:ERROR:gpu_channel.cc(449)] GpuChannel: Failed to create SharedImageStub


#
# Fatal error in , line 0
# Failed to deserialize the V8 snapshot blob. This can mean that the snapshot blob file is corrupted or missing.
#
#
#
#FailureMessage Object: 000000B6701FF4B0Backtrace:
        IsSandboxedProcess [0x00007FFCE39C0BE2+728514]
        IsSandboxedProcess [0x00007FFCE393DA32+191506]
        IsSandboxedProcess [0x00007FFCE43BFAD7+11209911]
        IsSandboxedProcess [0x00007FFCE3FBE089+7008873]
        ovly_debug_event [0x00007FFCE290463F+27991791]
        IsSandboxedProcess [0x00007FFCE43BD992+11201394]
        IsSandboxedProcess [0x00007FFCE43E55F3+11364307]
        IsSandboxedProcess [0x00007FFCE43E5D35+11366165]
        RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFCE5E04179+25911353]
        RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFCE61E7BAD+29989485]
        RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFCE515A5DC+12633244]
        RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFCE51597DC+12629660]
        RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFCE51594A8+12628840]
        IsSandboxedProcess [0x00007FFCE4427894+11635316]
        IsSandboxedProcess [0x00007FFCE39AB64D+641069]
        IsSandboxedProcess [0x00007FFCE39D1860+797248]
        BaseThreadInitThunk [0x00007FFD90BC244D+29]
        RtlUserThreadStart [0x00007FFD9238DFB8+40]

In exploring the notion that mf.dll might be missing the research found that mf.dll is related to Media Foundation features in Windows 11. I verified that the media player feature is enabled and installed in this Windows machine and ran "DISM.exe /Online /Cleanup-image /Scanhealth" to verify the integrity of the Windows 11 installation. The C:\Windows\System32\mf.dll file is present and appears to be the expected size. All appears healthy and normal. Both the Windows Player and legacy player are present and functional.

Then in reading the docs more, quarto says that the chromium engine/plugin is used to render the output. The tools list says its the latest, but I suspected the installation was corrupt and the tool list just verifies the version but not the integrity of its installation.

I uninstalled the chromium tool using quarto tools uninstall chromium then reinstalled with quarto tools install chromium.

The pdf rendering with mermaid worked after that.

Suggestions:

  1. The "quarto tool list" or another command could perform a integrity check.
  2. The documentation for PDF rendering (there are too many different pages on PDF rendering) should suggest uninstalling and reinstalling if there is a problem.

(Also, in the docs I think all the commands that read quarto install [x] should instead read quarto tools install [x].)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdiagrams-mermaidMermaid diagramspuppeteerIssues with puppeteer and remote chromium renderingwindows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions