hugolib: Prevent parallel server rebuilds
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 18 May 2019 06:38:58 +0000 (08:38 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 18 May 2019 07:01:40 +0000 (09:01 +0200)
commit95ce2a40e734bb82b69f9a64270faf3ed69c92cc
tree3391ca7d88672042ae5e2ef8f764797cbc381325
parenta83256b9cd5c50dde1a086a48f365a1fcbc78a24
hugolib: Prevent parallel server rebuilds

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 commit fixes that by protecting the `Build` method with a lock when running in server mode.

Fixes #5885
Fixes #5968
hugolib/hugo_sites.go
hugolib/hugo_sites_build.go