Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quarto + Julia: stack size exceeded error on MacOS

Here is a MWE that errors out on MacOS:

---
title: "Plots Demo"
author: "ITA"
format:
  html:
    code-fold: true
jupyter: julia-1.9
---

## Test plots

```{julia}
#| label: fig-errors
#| fig-cap: "Plotting causes stack exceeded error - MacOS"

using Plots
plotly()

dat = rand(1200, 68)
plot(dat)
```

On running quarto preview test.qmd the error that occurs is:

ERROR: RangeError: Maximum call stack size exceeded

What could be the reason for this error? I am using Quarto 1.3.361 on Ventura 13.4. Is the process running out of memory or just out of locations on the stack? Is there an environment variable to allow increasing the size of the call stack?

I tried wrapping the plot in a function as in this answer but I still get the error.

like image 495
ITA Avatar asked Jun 04 '26 09:06

ITA


1 Answers

Turns out that this error is raised by the underlying Javascript engine Deno. The fix is to set the environment variable

QUARTO_DENO_EXTRA_OPTIONS=--v8-flags=--stack-size=xxxx

to an appropriate size. The default size is 864 (not sure why that particular number).

On my machine ulimit -a reports 8176 kbytes so on setting the v8 flag to the same; the error disappeared. It would be nice to set it this value automatically in _quarto.yml on a per project basis but one can just use direnv or something as well.

like image 104
ITA Avatar answered Jun 07 '26 23:06

ITA



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!