Hi there,
I have an axum application running, connected to a postgres database, both on fly.
I am noticing that certain API calls, especially the ones querying larger date ranges, are returning 502 in the application. Here are some snippets from the logs:
2023-07-16T20:28:49.970 app[e286376be17e86] jnb [info] 2023-07-16T20:28:49.969Z INFO [sqlx_core::pool::inner] ping on idle connection returned error: error communicating with database: connection aborted
2023-07-16T20:21:16.872 proxy[e286376be17e86] jnb [error] could not make HTTP request to instance: connection closed before message completed
What I can glean from these logs is that the application is struggling to maintain a connection to postgres. And that the connection between app and db is being closed prematurely.
I have a suspicion that the TCP connection is simply timing out before the db finishes the query, as this issue only happens when I query a large date range in the application. What is the timout limit for inter-app communication? Is it configurable?
Beyond that, any feedback or advice would be much appreicated. Please let me know if you require more information from my side. Thanks!