Skip to content

v.145 httpcache crashes #13471

@gj52

Description

@gj52

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

0.145

Does this issue reproduce with the latest release?

YES

Repo to reproduce
https://github.com/gj52/HugoSample

HugoSample\config_default\hugo.toml

[caches]
  [caches.assets]
    dir = ':resourceDir/_gen'
    maxAge = -1
  [caches.getcsv]
    dir = ':cacheDir/:project'
    maxAge = -1
  [caches.getjson]
    dir = ':cacheDir/:project'
    maxAge = -1
  [caches.getresource]
    dir = ':cacheDir/:project'
    maxAge = -1
  [caches.images]
    dir = ':resourceDir/_gen'
    maxAge = -1
  [caches.misc]
    dir = ':cacheDir/:project'
    maxAge = -1
  [caches.modules]
    dir = ':cacheDir/modules'
    maxAge = -1

# https://gohugo.io/getting-started/configuration/#configure-http-cache
#[httpcache]
#  [httpcache.cache]
#    [httpcache.cache.for]
#      includes = ['https://img.youtube.com/**']
#    [[httpcache.polls]]
#      disable = true

remove the comment for httcache and hugo will crash

hugo server --watch -b http://localhost --renderToMemory --noHTTPCache --navigateToChanged --panicOnWarning --disableFastRender
panic: no includes or excludes

goroutine 1 [running]:
github.com/gohugoio/hugo/cache/httpcache.(*GlobMatcher).CompilePredicate(0xc0004971d0?)
        /root/project/hugo/cache/httpcache/httpcache.go:163 +0x3be
github.com/gohugoio/hugo/cache/httpcache.(*Config).Compile(0xc0004971d0)
        /root/project/hugo/cache/httpcache/httpcache.go:71 +0x170
github.com/gohugoio/hugo/config/allconfig.(*Config).CompileConfig(0xc000496d88, {0x2384a38, 0xc0003b2320})
        /root/project/hugo/config/allconfig/allconfig.go:392 +0xe36
github.com/gohugoio/hugo/config/allconfig.fromLoadConfigResult({0x237a000, 0x35927e0}, {0x2384a38, 0xc0003b2320}, {{0x237ca90, 0xc0003a61e0}, {0xc00025e780, 0x2, 0x2}, {{0xc00034e2c0, ...}, ...}})
        /root/project/hugo/config/allconfig/allconfig.go:935 +0x297
github.com/gohugoio/hugo/config/allconfig.LoadConfig({{0x237a000, 0x35927e0}, {0x2384a38, 0xc0003b2320}, {0x237ca90, 0xc0003a6140}, {0x0, 0x0}, {0x1df4a31, 0x6}, ...})
        /root/project/hugo/config/allconfig/load.go:62 +0x465
github.com/gohugoio/hugo/commands.(*rootCommand).ConfigFromProvider.func1({0x5b7900?, 0xc0?})
        /root/project/hugo/commands/commandeer.go:244 +0x2dc
github.com/bep/lazycache.(*Cache[...]).GetOrCreate.func1(0xc0005b798a?, 0x0, {0x330b10?, 0xc0?}, 0x0?, 0x0?)
        /root/project/gomodcache/github.com/bep/lazycache@v0.7.0/lazycache.go:140 +0xa5
github.com/bep/lazycache.(*Cache[...]).GetOrCreate(0x23913e0, {0xad500, 0xc0?}, 0xc0005b79e0?)
        /root/project/gomodcache/github.com/bep/lazycache@v0.7.0/lazycache.go:144 +0x15e
github.com/gohugoio/hugo/commands.(*rootCommand).ConfigFromProvider(0xc00014ecc0?, {0x237ca90?, 0x0?}, {0x237ca90, 0xc0003a6140})
        /root/project/hugo/commands/commandeer.go:223 +0x51
github.com/gohugoio/hugo/commands.(*hugoBuilder).loadConfig(0xc0003f6300, 0xc00014ecc0, 0x1)
        /root/project/hugo/commands/hugobuilder.go:1055 +0x413
github.com/gohugoio/hugo/commands.(*serverCommand).PreRun(0xc000445d60, 0xc00014ecc0, 0xc00014ecc0?)
        /root/project/hugo/commands/server.go:617 +0x25e
github.com/bep/simplecobra.(*Commandeer).init(0xc00014ecc0)
        /root/project/gomodcache/github.com/bep/simplecobra@v0.5.0/simplecobra.go:92 +0xc2
github.com/bep/simplecobra.(*Commandeer).compile.func2(0xc0000ad500?, {0x1dec94a?, 0x4?, 0x1dec72e?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.5.0/simplecobra.go:119 +0x17
github.com/spf13/cobra.(*Command).execute(0xc000240008, {0xc0003f6200, 0x8, 0x8})
        /root/project/gomodcache/github.com/spf13/cobra@v1.9.1/command.go:1000 +0xa13
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002df208)
        /root/project/gomodcache/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
        /root/project/gomodcache/github.com/spf13/cobra@v1.9.1/command.go:1080
github.com/bep/simplecobra.(*Exec).Execute(0xc00041c7f0, {0x236adb0?, 0x35927e0?}, {0xc0000ac010?, 0x381d200?, 0x15?})
        /root/project/gomodcache/github.com/bep/simplecobra@v0.5.0/simplecobra.go:155 +0xd4
github.com/gohugoio/hugo/commands.Execute({0xc0000ac010, 0x9, 0xf})
        /root/project/hugo/commands/commandeer.go:68 +0x2f3
main.main()
        /root/project/hugo/main.go:25 +0x56

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions