Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix concurrent write panic for parallel test #472

Open
longquanzheng opened this issue Oct 30, 2024 · 1 comment
Open

Fix concurrent write panic for parallel test #472

longquanzheng opened this issue Oct 30, 2024 · 1 comment
Labels
bug Something isn't working techdebt

Comments

@longquanzheng
Copy link
Contributor

longquanzheng commented Oct 30, 2024

Maybe using sync.Map: https://medium.com/@luanrubensf/concurrent-map-access-in-go-a6a733c5ffd1 instead here:

h.invokeHistory[req.GetWorkflowStateId()+"_start"]++

fatal error: concurrent map writes

goroutine 7953 [running]:
github.com/indeedeng/iwf/integ/workflow/parallel.(*handler).ApiV1WorkflowStateStart(0xc000fd0138, 0xc00053f600)
	/home/runner/work/iwf/iwf/integ/workflow/parallel/routers.go:45 +0x274
github.com/gin-gonic/gin.(*Context).Next(...)
	/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc00053f600)
	/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 +0x6f
github.com/gin-gonic/gin.(*Context).Next(...)
	/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/gin-gonic/gin.LoggerWithConfig.func1(0xc00053f600)
	/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:240 +0xdd
github.com/gin-gonic/gin.(*Context).Next(...)
	/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0004f0000, 0xc00053f600)
	/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 +0x64e
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0004f0000, {0x199f280, 0xc00035d260}, 0xc000527540)
	/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 +0x1b2
net/http.serverHandler.ServeHTTP({0x199adc8?}, {0x199f280?, 0xc00035d260?}, 0x6?)
	/opt/hostedtoolcache/go/1.23.2/x64/src/net/http/server.go:3210 +0x8e
net/http.(*conn).serve(0xc000e730e0, {0x19a6538, 0xc000c22f30})
	/opt/hostedtoolcache/go/1.23.2/x64/src/net/http/server.go:2092 +0x5d0
created by net/http.(*Server).Serve in goroutine 7791
	/opt/hostedtoolcache/go/1.23.2/x64/src/net/http/server.go:3360 +0x485
@longquanzheng longquanzheng added the bug Something isn't working label Oct 30, 2024
@longquanzheng
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working techdebt
Projects
None yet
Development

No branches or pull requests

1 participant