504 gateway timeout can lead to DB connection leak and how to fix

55 Views Asked by At

My Java (Quarkus) API server is behind a k8s ingress, which has a 60 second timeout threshold. When ingress does not get response from API server, it gives 504 error.

I noticed that these 504 error always coincide with the log:

Connection leak of io.opentracing.contrib.jdbc.TracingConnection

I wonder if the ingress will sever the connection and thus cause the DB leak?

In my java code, I already used the try-with-resources block to ensure the connection is always closed, e.g.

    @Inject DataSource dataSource;
    ...
    try (Connection connection = dataSource.getConnection()) {
       // do things with the connection
    } catch (Exceptoin e)

Anything I can do to resolve this db connection leak problem?

0

There are 0 best solutions below