Skip to content

Panic when using dynamic depth #443

Description

@pixiono

Hello,

I use Chartmueseum with a dynamic depth. When I looked in the logs, I noticed some panic messages when I try to call Chartmuseum URL by browser.

So I enabled the debug output I noticed the problem:

{"L":"DEBUG","T":"2021-03-30T11:41:04.789Z","M":"[522] Incoming request: /api/test/charts","reqID":"579fe81d-cd77-4f20-ae05-da80661ef9c2"}
{"L":"DEBUG","T":"2021-03-30T11:41:04.789Z","M":"[522] Fetching chart list from storage","repo":"test","reqID":"579fe81d-cd77-4f20-ae05-da80661ef9c2"}
{"L":"DEBUG","T":"2021-03-30T11:41:04.812Z","M":"[522] No change detected between cache and storage","repo":"test","reqID":"579fe81d-cd77-4f20-ae05-da80661ef9c2"}
{"L":"INFO","T":"2021-03-30T11:41:04.812Z","M":"[522] Request served","path":"/api/test/charts","comment":"","clientIP":"10.131.90.20","method":"GET","statusCode":200,"latency":"22.790685ms","reqID":"579fe81d-cd77-4f20-ae05-da80661ef9c2"}
{"L":"DEBUG","T":"2021-03-30T11:41:04.851Z","M":"[523] Incoming request: /favicon.ico","reqID":"fcaa3890-671b-471b-b4ef-35add7c31417"}
 
2021/03/30 11:41:04 [Recovery] 2021/03/30 - 11:41:04 panic recovered:
runtime error: slice bounds out of range [1:0]
/usr/local/go/src/runtime/panic.go:116 (0x434504)
/go/src/github.com/helm/chartmuseum/pkg/chartmuseum/router/match.go:106 (0x1192011)
/go/src/github.com/helm/chartmuseum/pkg/chartmuseum/router/router.go:210 (0x119414d)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0x11909f8)
/go/pkg/mod/github.com/zsais/[email protected]/middleware.go:364 (0x11909d8)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0x114b959)
/go/pkg/mod/github.com/gin-contrib/[email protected]/size.go:88 (0x114b940)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0x1194a46)
/go/src/github.com/helm/chartmuseum/pkg/chartmuseum/router/middleware.go:48 (0x1194a05)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0x112fb50)
/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:83 (0x112fb37)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 (0x1127068)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:445 (0x112704f)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:438 (0x1126d7b)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:367 (0x11265ec)
/usr/local/go/src/net/http/server.go:2887 (0x6fad62)
/usr/local/go/src/net/http/server.go:1952 (0x6f618c)
/usr/local/go/src/runtime/asm_amd64.s:1371 (0x46da00)

It looks like my Chrome Browser is trying to get a favicon, which of course doesn't work. Unfortunately this call causes a panic message. When I do a curl on the api (withot favicon ;)) I don't have this problem.

I tested also some other urls with the same behavior, like:

{"L":"DEBUG","T":"2021-03-30T11:42:30.385Z","M":"[541] Incoming request: /api/test/test","reqID":"57793d9a-4e6a-4db4-827c-9489c97826be"}
 
 
2021/03/30 11:42:30 [Recovery] 2021/03/30 - 11:42:30 panic recovered:
runtime error: slice bounds out of range [2:1]
/usr/local/go/src/runtime/panic.go:116 (0x434504)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions