couper icon indicating copy to clipboard operation
couper copied to clipboard

json sync leaks go-routine with `-watch` flag

Open malud opened this issue 2 years ago • 0 comments

Describe the bug The SyncedJSON new() method is missing the command context to shutdown the initialized goroutine on configuration-file changes. See https://github.com/avenga/couper/blob/master/json/synced_json.go#L53

To Reproduce Steps to reproduce the behavior:

  1. Which Couper version? Run couper version or docker run avenga/couper version
edge 2022-08-24 add847c
go version go1.19 linux/amd64
  1. Provide your configuration file *.hcl. Remove sensitive data.

https://github.com/avenga/couper-oidc-gateway/blob/master/couper.hcl

  1. Provide a curl call for reproduction
  1. See an error response or error log.
  • Provide valid oidc parameters, see https://github.com/avenga/couper-oidc-gateway/blob/master/README.md
  • start with couper run -f oidc-conf.hcl -watch -debug.
  • browse to http://localhost:6060/debug/pprof/goroutine?debug=1 and have a look at the goroutine count for json.(*SyncedJSON).sync
  • do unrelated changes to the config to trigger a -watch related reload.
  • with every reload the goroutine count for json.(*SyncedJSON).sync will increase

Expected behavior goroutine shutdown on command cancel

malud avatar Aug 24 '22 07:08 malud