Getting "closed pool" error under high load testing #1842
EmadBinAbid
started this conversation in
General
Replies: 1 comment 1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was performing some DOS load testing for my application. When I increased the load high enough, the overall CPU usage increased to the level where Kubernetes decided to restart the main server pod (let's call it A). This started the application shutdown procedure, which resulted in "closed pool" error entries from DB operations in the logs.
The code to gracefully shutdown the server in my application looks something like below (simplified version):
CloseServerHandler
is a helper function that catches application termination signals and broadcasts termination over the terminate channel by closing it. It also runs the shutdown operation on the server and waits for it to finish. It callsShutdown()
function fromgo/src/net/http
package, which guarantees that the shutdown routine waits indefinitely for connections to return to idle and then shut down.I have
p.Close()
in the defer block, so it will only run once the shutdown process is completed gracefully and the program control returns to the main thread. So, at this point, I don't really feel like doubting the positioning ofp.Close()
.Curious if there is something that might be causing the pool to get closed prematurely because of high load testing?
I am using
v5.4.3
ofpgx
.Beta Was this translation helpful? Give feedback.
All reactions