Details
-
Bug
-
Resolution: Fixed
-
Minor
-
4.0.0
-
Security Level: Public
-
None
-
Untriaged
-
Unknown
Description
The generated lexer code creates a goroutine which is occasionally leaked;
A test with 1800 requests showed 200 live instances of it at the end.
A test with 3600 requests showed 400 live instances of it at the end.
The goroutine in question is created by n1ql.NewLexerWithInit. Example:
goroutine 579 [chan send, 6 minutes]:
github.com/couchbase/query/parser/n1ql.funcĀ·004(0xc2081192c0, 0xc208119260, 0xc208bfa000, 0xc7, 0xc7, 0x0, 0xb)
/Users/colm/src/github.com/couchbase/query/parser/n1ql/n1ql.nn.go:134 +0x9c8
created by github.com/couchbase/query/parser/n1ql.NewLexerWithInit
/Users/colm/src/github.com/couchbase/query/parser/n1ql/n1ql.nn.go:19870 +0x39192
This is actually generated code (by the 3rd party nex tool).
To reproduce, run query engine with pprof enabled (per https://golang.org/pkg/net/http/pprof/#pkg-overview), and view the live goroutine dump at the end of a test run of queries:
http://localhost:6060/debug/pprof/goroutine?debug=2