commit 6b3f1a10028c81b776a5797bbd02c86957f8f042
parent e22b3f54c3d8ce6567c21c63beab0b03cf7983ea
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Sat, 18 May 2019 10:18:23 +0200
Merge branch 'release-0.55.6'
Diffstat:
3 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/docs/content/en/news/0.55.6-relnotes/index.md b/docs/content/en/news/0.55.6-relnotes/index.md
@@ -0,0 +1,13 @@
+
+---
+date: 2019-05-18
+title: "0.55.6"
+description: "0.55.6"
+categories: ["Releases"]
+images:
+- images/blog/hugo-bug-poster.png
+
+---
+
+ This is a bug-fix release with one important fix. There have been reports about infrequent paginator crashes when running the Hugo server since 0.55.0. The reason have been narrowed down to that of parallel rebuilds. This isn't a new thing, but the changes in 0.55.0 made it extra important to serialize the page initialization. This release fixes that by protecting the `Build` method with a lock when running in server mode. [95ce2a40](https://github.com/gohugoio/hugo/commit/95ce2a40e734bb82b69f9a64270faf3ed69c92cc) [@bep](https://github.com/bep) [#5885](https://github.com/gohugoio/hugo/issues/5885)[#5968](https://github.com/gohugoio/hugo/issues/5968)
+
diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go
@@ -62,6 +62,9 @@ type HugoSites struct {
// If this is running in the dev server.
running bool
+ // Serializes rebuilds when server is running.
+ runningMu sync.Mutex
+
// Render output formats for all sites.
renderFormats output.Formats
diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go
@@ -31,6 +31,12 @@ import (
// Build builds all sites. If filesystem events are provided,
// this is considered to be a potential partial rebuild.
func (h *HugoSites) Build(config BuildCfg, events ...fsnotify.Event) error {
+ if h.running {
+ // Make sure we don't trigger rebuilds in parallel.
+ h.runningMu.Lock()
+ defer h.runningMu.Unlock()
+ }
+
ctx, task := trace.NewTask(context.Background(), "Build")
defer task.End()