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

_index.md + HTML file w/o front matter causes hugo serve to hang during re-render #7028

Closed
benkuhn opened this issue Mar 7, 2020 · 4 comments · Fixed by #7034
Closed

_index.md + HTML file w/o front matter causes hugo serve to hang during re-render #7028

benkuhn opened this issue Mar 7, 2020 · 4 comments · Fixed by #7034

Comments

@benkuhn
Copy link

benkuhn commented Mar 7, 2020

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.66.0/extended darwin/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

Yes

Steps to reproduce:

Note that I haven't found a minimal repro and the site that I know reproduces this is private.

If it's not easy to diagnose the error from the stack traces I've attached below, I'm happy to try to minimize the reproduction, but I suspect it's something about my custom theme and am not looking forward to trying to minimize it--so I'm posting here first in case the stack traces make it obvious.

Steps:

  1. Use the following content hierarchy:
# content/posts/drafts/_index.md
---
cascade:
    draft: true
---
# content/posts/drafts/conviction.md
---
title: ...
---

...
  1. hugo serve --buildDrafts
  2. Navigate to /conviction/, the URL of a draft post
  3. Edit the draft post by inserting a paragraph containing "asdf" at the beginning
  4. Observe that the browser does not auto-reload
  5. Observe that the server never the log line Source changed "/Users/ben/code/benkuhn.net/content/posts/drafts/conviction.md": WRITE, but not the next expected line Total in <X> ms
  6. Try to navigate to another page (that hasn't been rendered yet)
  7. Observe an infinite loading spinner

The problem does not reproduce if I remove the drafts/_index.md file and add draft: true to conviction.md. It also does not reproduce when I edit a non-draft. It does reproduce with --disableFastRender or --disableLiveReload.

I ran the first step with GOTRACEBACK=all and sent SIGQUIT to the server while it was hung; it produced the following stacktraces:

stacktrace.txt

I also ran it with --trace and it produced the following file (gzipped so github will let me upload):
hugo-trace.gz

As I mentioned, I couldn't reproduce this with a blank site, so there must be some other part of my config that's interacting with the cascade: {draft: true} setting. Please let me know if you have ideas for what that could be, as it'll help me create a minimal repro.

@bep bep added this to the v0.66.1 milestone Mar 7, 2020
@benkuhn
Copy link
Author

benkuhn commented Mar 7, 2020

OK, I have a minimal repro. The missing piece was a raw HTML file inside the drafts/ folder. Repro repository here: https://github.com/benkuhn/hugo-repro

@benkuhn benkuhn changed the title Folder with cascade: {draft: true} seems to cause hugo serve to hang during render cascade: {draft: true} + raw HTML file causes hugo serve to hang during re-render Mar 7, 2020
@bep
Copy link
Member

bep commented Mar 7, 2020

@benkuhn I think that hang has been reported by someone else and not related to draft, but I haven't been able to reproduce it ... so thanks alot!

@benkuhn
Copy link
Author

benkuhn commented Mar 7, 2020

You're totally right, the draft thing was a red herring, all that matters is the existence of an _index.md file at all. I've pruned the repro repository even further.

@benkuhn benkuhn changed the title cascade: {draft: true} + raw HTML file causes hugo serve to hang during re-render _index.md + HTML file w/o front matter causes hugo serve to hang during re-render Mar 7, 2020
bep added a commit to bep/hugo that referenced this issue Mar 9, 2020
This means that any HTML file inside /content will be treated as a regular file.

If you want it processes with shortcodes and a layout, add front matter.

The defintion of an HTML file here is:

* File with extension .htm or .html
* With first non-whitespace character "<" that isn't a HTML comment.

This is in line with the documentation.

Fixes gohugoio#7030
Fixes gohugoio#7028
See gohugoio#6789
@bep bep closed this as completed in #7034 Mar 9, 2020
bep added a commit that referenced this issue Mar 9, 2020
This means that any HTML file inside /content will be treated as a regular file.

If you want it processes with shortcodes and a layout, add front matter.

The defintion of an HTML file here is:

* File with extension .htm or .html
* With first non-whitespace character "<" that isn't a HTML comment.

This is in line with the documentation.

Fixes #7030
Fixes #7028
See #6789
@bep bep modified the milestones: v0.66.1, v0.67 Mar 9, 2020
@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants