Neo4j Intermittent Connection Issues

Hello, I've been having issues ever since I placed an Nginx proxy in front of neo4j and was hoping for some insight.

We have

(1) Docker VM with Flask & the neo4j driver
(2) Connected to an external VM with Nginx that is using the 'stream' directive to forward the TCP connection to Neo4j

Everything is default in the Neo4j driver. When I initially load the flask application, I see there are some connections to the Neo4j database. I verify this through the Neo4j browser with the dbms.listConnections(). After idling for 10 minutes, I call dbms.listConnections() again and I see no connections. I had thought the "max_connection_lifetime", which is set to 3600 seconds, would prevent this.

I know I'm missing something here, but can't seem to pinpoint where.

max_connection_lifetime only affects connections that are idling in the connection pool, i.e., are not executing any work, and they only get terminated once they are picked up from the pool again and have exceeded the lifetime.

Next, the driver will not open connections for the sake of it. So as long as you don't run any queries, it might, or it might not have idle connections open to the server.

Finally, the driver should open one initial connection to the server to fetch routing information to support clustering, which is an enterprise only feature, but the driver has to ask the server if there is a cluster none the less. Now, that connection should probably survive as idle connection in the pool. However, there is a non-critical bug in the 4.2 Python driver that closes that connection (this is at best a performance concern).

I hope that helps a bit to understand what's going on.