Reopening this bug as I don't want this to fall off the radar.
Even after waiting for long time, routines don't clean up. Ideally from a sdk library one would expect to have all necessary handles to gracefully cleanup routines on bucket.Close(). In present scenario with eventing when lambdas are (re)deployed(it would tear down old setup and create new one) quite a few times during tests, it's common to notice that gocb sdk is leaking 50+ goroutines. Not sure why any other gocb consumer is reporting this pain point.(Note: similar issue doesn't show with go-couchbase)
Prime reason, eventing chose gocb is because of support for xattr via subdoc operation. But if this problem isn't getting addressed then we might have to look into porting subdoc support in go-couchbase(ideally we don't want to duplicate the effort for something that's already in place in gocb).