Skip to content

Modifying many files simultaneously causes crashes #10263

@earthboundkid

Description

@earthboundkid

Essentially every time I check out a different branch in git or run prettier over my files, Hugo crashes. Here's the most recent crash:

Details
goroutine 19169 [running]:
github.com/gohugoio/hugo/hugolib.(*Site).renderPaginator(0xc0739ff440, 0xc0250dfd70, {0x63f1bd8, 0xc0168b3c20})
        github.com/gohugoio/hugo/hugolib/site_render.go:193 +0x65f
github.com/gohugoio/hugo/hugolib.pageRenderer(0x4c9c3c5?, 0xc0739ff440, 0xc000508fd0?, 0x4c9c346?, 0xc00c6cd170?)
        github.com/gohugoio/hugo/hugolib/site_render.go:143 +0x2f2
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
        github.com/gohugoio/hugo/hugolib/site_render.go:74 +0x108

And another:

Details
panic: runtime error: index out of range [0] with length 0

goroutine 2824 [running]:
github.com/gohugoio/hugo/hugolib.(*pageState).shiftToOutputFormat(0xc06661a6f0, 0x1, 0x0)
        github.com/gohugoio/hugo/hugolib/page.go:859 +0x3d3
github.com/gohugoio/hugo/hugolib.(*pageState).initOutputFormat(...)
        github.com/gohugoio/hugo/hugolib/page.go:455
github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender.func1(0x3673e900?)
        github.com/gohugoio/hugo/hugolib/hugo_sites.go:853 +0x2a
github.com/gohugoio/hugo/hugolib.(*pageMap).withEveryBundlePage.func1({0x402d365?, 0x20300a?}, 0x400?)
        github.com/gohugoio/hugo/hugolib/content_map_page.go:691 +0x2a
github.com/gohugoio/hugo/hugolib.contentTrees.Walk.func1({0xc0732a1668?, 0x3673ea00?}, {0x5abc720?, 0xc0744d8c60?})
        github.com/gohugoio/hugo/hugolib/content_map.go:876 +0x3b
github.com/armon/go-radix.recursiveWalk(0xc0744d8cc0, 0xc00e3554c8)
        github.com/armon/go-radix@v1.0.0/radix.go:519 +0x45
github.com/armon/go-radix.recursiveWalk(0x66?, 0xc00e3554c8)
        github.com/armon/go-radix@v1.0.0/radix.go:525 +0xb3
github.com/armon/go-radix.recursiveWalk(0x12?, 0xc00e3554c8)
        github.com/armon/go-radix@v1.0.0/radix.go:525 +0xb3
github.com/armon/go-radix.recursiveWalk(0x0?, 0xc00e3554c8)
        github.com/armon/go-radix@v1.0.0/radix.go:525 +0xb3
github.com/armon/go-radix.recursiveWalk(0x5d48ec2?, 0xc00e3554c8)
        github.com/armon/go-radix@v1.0.0/radix.go:525 +0xb3
github.com/armon/go-radix.(*Tree).Walk(...)
        github.com/armon/go-radix@v1.0.0/radix.go:447
github.com/gohugoio/hugo/hugolib.contentTrees.Walk({0xc073c41c60?, 0x4?, 0x512d959?}, 0xc00e355508?)
        github.com/gohugoio/hugo/hugolib/content_map.go:874 +0x5b
github.com/gohugoio/hugo/hugolib.(*pageMap).withEveryBundlePage(0xc0129445b0?, 0x0?)
        github.com/gohugoio/hugo/hugolib/content_map_page.go:689 +0x47
github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender(0x5cd9ee0?, 0x0?, 0x512d08a?)
        github.com/gohugoio/hugo/hugolib/hugo_sites.go:852 +0x5e
github.com/gohugoio/hugo/hugolib.(*HugoSites).render(0xc06d5aea80, 0xc07444e640)
        github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:308 +0x585
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func4()
        github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:147 +0x2a
runtime/trace.WithRegion({0x63f8e30?, 0xc074d180f0?}, {0x5d4e739, 0x6}, 0xc00e3558a8)
        runtime/trace/annotation.go:141 +0xe3
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0xc06d5aea80, {0x0, {0x0, 0x0}, 0x0, 0x0, 0x0, 0x0, 0xc074d180c0, 0x0, ...}, ...)
        github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:149 +0x5f9
github.com/gohugoio/hugo/commands.(*commandeer).rebuildSites(0xc0002f1590, {0xc074d11fb0?, 0x2?, 0x2?})
        github.com/gohugoio/hugo/commands/hugo.go:765 +0x210
github.com/gohugoio/hugo/commands.(*commandeer).handleEvents.func4(0xc0002f1590, 0xc074d16060)
        github.com/gohugoio/hugo/commands/hugo.go:1157 +0x96
github.com/gohugoio/hugo/commands.(*commandeer).handleEvents(0xc0002f1590, 0xc02b2b1dd0, 0xc03baf6998, {0xc073b57c50?, 0x2, 0x2}, 0xc011f20de0?)
        github.com/gohugoio/hugo/commands/hugo.go:1160 +0xc5a
github.com/gohugoio/hugo/commands.(*commandeer).newWatcher.func1()
        github.com/gohugoio/hugo/commands/hugo.go:895 +0x265
created by github.com/gohugoio/hugo/commands.(*commandeer).newWatcher
        github.com/gohugoio/hugo/commands/hugo.go:886 +0x3ca
# status: 2 #

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

hugo v0.102.3+extended darwin/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions