getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.85k stars 960 forks source link

thread 'main' has overflowed its stack #2065

Closed dxps closed 10 months ago

dxps commented 1 year ago

Bug Report

Environment

Zola version: 0.16.1 Pop!_OS 22.04 LTS (up to date, with kernel 6.0.12-76060006-generic)

Expected Behavior

zola serve should just continue working, instead of crashing.

Current Behavior

zola serve crashes.

Step to reproduce

Just quickstarting it by following the Overview doc, using the official sam.

{% extends "index.html" %}

{% import "macros.html" as macros %}

{% block htmltitle %}
{% endblock htmltitle %}

{% block body %}
<div class="wrap">
    <div class="section" id="title">
        {% block title %}{% endblock title %}
    </div>
    <div class="section" id="sections">
        {% block sections %}{% endblock sections %}
    </div>
    <div class="section" id="content">
        {% block content %}{% endblock content %}
    </div>
    {{ macros::bottom_menu() }}
    {{ macros::footer() }}
</div>
{% endblock body %}
{% extends "base.html" %}

{% block content %}
<h1 class="title">
    This is my blog made with Zola.
</h1>
{% endblock content %}

It crashes after saving that content into index.html file, and also at start up:

…/test_zola ❯ RUST_BACKTRACE=1 zola serve
Building site...

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Aborted (core dumped)
…/test_zola took 1s❯

Hope it helps the investigation! I'm very new to Zola, and depending on the outcome I might try to help as well.

Thanks!

dxps commented 1 year ago

Oh, I believe this is simply because each page extends the other. :facepalm:

I leave it here as a case for improving the behavior by reporting to the console that such setup is wrong instead of crashing due to stack overflow. If you don't want to consider it as a future enhancement, you may close it.

Last but not least, many thanks to this community for creating Zola. :pray: Today, I started using it as the SSG for my GitHub Pages. :partying_face:

Keats commented 1 year ago

Weird that Tera is not catching that though!

0xcrypto commented 1 year ago

Facing the same error in Zola v0.17.2 windows build. Same site using Zola v0.17.2 is building fine on Fedora and Ubuntu (Github Actions).

zola serve and zola build both give following error:

PS D:\> zola serve
Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 43 pages (0 orphan) and 2 sections

thread 'main' has overflowed its stack

I am not using macros or shortcodes. Only 4 taxonomies and one taxonomy is iterated for pages on home page. zola serve works fine for a new blank site.

Keats commented 1 year ago

Is it the same case? Do you have templates extending each other?

0xcrypto commented 1 year ago

Is it the same case? Do you have templates extending each other?

Templates extending each other, no. Just extending base.html in index.html and page.html. Code is available at https://github.com/0xcrypto/0xcrypto.github.io if you wanna take a look. I have now added macros but only after reporting this error.

Unfortunately I wont be able to test again on windows or provide much information as my m.2 SSD having Windows is dead (different issue).

Keats commented 1 year ago

I can reproduce it with the next version so it's not OS related.

0xcrypto commented 1 year ago

I can reproduce it with the next version so it's not OS related.

I used same codebase, same versions (0.17.2) on Linux and Windows though. In linux it works, in windows it does not.

Keats commented 1 year ago

ah I tested on Mac

0xcrypto commented 11 months ago

Tried again today, didn't work in Windows but worked fine in WSL (Kali Linux).

Keats commented 11 months ago

That should be fixed on the next branch

0xcrypto commented 11 months ago

Thank you @Keats, next is working!