I have a spring boot rest API utilizing 2 datasources. The one datasource keeps leaking connections and the active amount just keeps increasing over time until it reaches its' max and then the client cannot get a connection afterwards. When I run this from my local eclipse install under a similar load, I can see from the trace that the connections are being returned and they never increase over single digits so I don't see the connection leak. However, when this is deployed to a docker container utilizing nginx as a reverse proxy, it consistently leaks the connections no matter what configurations I give it. I am using the most recent version of Hikari. Can this be a potential issue with the docker container holding connections for some reason? Any help would be great.
Look at your connection pool definition. You should have an option to track leaks. It works by taking a stack snapshot when you pull a Connection from the pool, and printing out the snapshot if the Connection has not been returned within a set amount of time. Knowing where you got the Connection can usually help you figure out where it's being used and where it might be getting lost. And if the path over which it's being used is too long and convoluted to follow, that in itself is a signal of probable poor design. Better to get a Connection and give it back repeatedly than to hoard it. Checking a Connection in and out of the Connection pool is a very low-overhead thing to do.
Incidentally, Spring Data, when properly used, leak-proofs Connections.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.