pq: Goroutine leak on context timeout

Howdy,

I have a system stress testing some sql queries, using context cancellation.

I basically do a lot of requests that take more than 25 seconds and have a context that cancels them after 25 seconds. But for every iteration of this stress test I get goroutine leak.

goroutine profile: total 105
74 @ 0x42e70a 0x42e7ee 0x40597d 0x40568d 0x8fc44e 0x45b971
#	0x8fc44d	.../api/vendor/github.com/lib/pq.(*conn).watchCancel.func1+0xcd	.../api/vendor/github.com/lib/pq/conn_go18.go:65

Then another test:

108 @ 0x42e70a 0x42e7ee 0x40597d 0x40568d 0x8fc44e 0x45b971
#	0x8fc44d	.../api/vendor/github.com/lib/pq.(*conn).watchCancel.func1+0xcd	.../api/vendor/github.com/lib/pq/conn_go18.go:65

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

It would be helpful if you could share some code. You can replace the body of the query with a sleep.