lzanini / mdbook-katex

A preprocessor for mdBook, rendering LaTex equations to HTML at build time.
MIT License
205 stars 34 forks source link

Error: The "katex" preprocessor exited unsuccessfully with signal: 6 (SIGABRT) (core dumped) status #90

Closed CatspersCoffee closed 1 year ago

CatspersCoffee commented 1 year ago

mdbook failing to build, or serve

$ mdbook build
2023-05-30 09:54:44 [INFO] (mdbook::book): Book building has started

thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow
2023-05-30 09:54:44 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with signal: 6 (SIGABRT) (core dumped) status

versions:

mdbook v0.4.30
katex = "0.4.6"

my book.toml:

[book]
authors = ["Catsper"]
language = "en"
multilingual = false
src = "src"
title = "Notes"

[output.html]

[output.katex]

[preprocessor.katex]
SichangHe commented 1 year ago
  1. Please note the mdBook-KaTeX version.
  2. Please remove [output.katex] in your book.toml as per #68.

I have never seen this error using mdBook-KaTeX. It looks like an infinite recursion, but we don't use deep recursion any more.

CatspersCoffee commented 1 year ago

Removing [output.katex] unfortunately does not change the error:

$ mdbook serve
2023-05-30 11:27:32 [INFO] (mdbook::book): Book building has started

thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow
2023-05-30 11:27:32 [ERROR] (mdbook::utils): Error: The "katex" preprocessor exited unsuccessfully with signal: 6 (SIGABRT) (core dumped) status
$ mdbook-katex --version
mdbook-katex 0.5.2
SichangHe commented 1 year ago

So, you are using the latest version. Did the previous version work for you?

This error message does not point to any specific places in the code, unfortunately. So, it would be much easier to debug if you could provide the book that result in this error. Maybe I could try and reproduce it.

SichangHe commented 1 year ago

https://github.com/lzanini/mdbook-katex/blob/619e0882222fd96d6e6e1873d4449113d7fb45d5/src/scan.rs#L76 It seems that we do have recursion. I will create a hot fix.

I assume some of your chapters are very long, right?

SichangHe commented 1 year ago

Thank you, @CatspersCoffee, for reporting this stack overflow issue 🌮.

Please verify that v0.5.3 fixes this issue once it comes out: https://github.com/lzanini/mdbook-katex/actions/runs/5117413832

CatspersCoffee commented 1 year ago

Can report that v0.5.3 fixes the issue.

Replaced package `mdbook-katex v0.5.2` with `mdbook-katex v0.5.3` (executable `mdbook-katex`)

Thankyou @SichangHe for the speedy reply and hotfix :-)

SichangHe commented 1 year ago

You are welcome, @CatspersCoffee. Your early report will save other users from experiencing my unfortunate mistake. And, you help me remember not to use tail recursion in Rust 😅.