gin icon indicating copy to clipboard operation
gin copied to clipboard

c.GetPostForm concurrent map read and write

Open kassie4kassie opened this issue 2 years ago • 0 comments

  • With issues:
    • Use the search tool before opening a new issue.
    • Please provide source code and commit sha if you found a bug.
    • Review existing issues and provide feedback or react to them.

Description

fatal error: concurrent map read and map write

goroutine 748 [running]: runtime.throw(0x32fb97f, 0x21) /usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc000f53740 sp=0xc000f53710 pc=0x439ed2 runtime.mapaccess1_faststr(0x2fcb580, 0xc002b79c80, 0x32a8aa7, 0xc, 0x70c010) /usr/local/go/src/runtime/map_faststr.go:21 +0x465 fp=0xc000f537b0 sp=0xc000f53740 pc=0x4160e5 net/textproto.MIMEHeader.Get(0xc002b79c80, 0x32a8aa7, 0xc, 0x38a, 0x0) /usr/local/go/src/net/textproto/header.go:34 +0x5f fp=0xc000f537e8 sp=0xc000f537b0 pc=0x6965ff net/http.Header.Get(...) /usr/local/go/src/net/http/header.go:46 net/http.(*Request).multipartReader(0xc0080a7800, 0x0, 0x0, 0x30, 0x30db1a0) /usr/local/go/src/net/http/request.go:475 +0x48 fp=0xc000f53858 sp=0xc000f537e8 pc=0x707da8 net/http.(*Request).ParseMultipartForm(0xc0080a7800, 0x2000000, 0x10, 0x2d58ae0) /usr/local/go/src/net/http/request.go:1291 +0x77 fp=0xc000f53950 sp=0xc000f53858 pc=0x70c257 github.com/gin-gonic/gin.(*Context).initFormCache(0xc0074aae00) /opt/tiger/compile_path/pkg/mod/github.com/gin-gonic/[email protected]/context.go:508 +0x8f fp=0xc000f539a8 sp=0xc000f53950 pc=0xdef66f github.com/gin-gonic/gin.(*Context).GetPostFormArray(...) /opt/tiger/compile_path/pkg/mod/github.com/gin-gonic/[email protected]/context.go:520 github.com/gin-gonic/gin.(*Context).GetPostForm(0xc0074aae00, 0xc000f93f38, 0x2, 0x2d58ae0, 0xc000f53a01, 0xc0055a1d70)

How to reproduce

Randomly happened, not sure what actually triggered it.

Expectations

no panic

Actual result

randomly throws panic

Environment

  • go version: 1.13.
  • gin version (or commit ref):1.7.2
  • operating system:

kassie4kassie avatar Aug 05 '22 08:08 kassie4kassie