Hi!
By now I'm sure you've seen https://github.blog/2020-05-20-three-bugs-in-the-go-mysql-driver/, and it struck me as interesting to investigate whether pgx suffers from any issues around this as well. I assume with the postgres protocol being different from the mysql protocol that the TCP close issues are not an issue specifically, but both the timeout and race issues could potentially affect pgx as well.
What do you think?
Regarding lost connections:
I agree with some of the dissent on the original MySQL issue https://github.com/go-sql-driver/mysql/issues/657 where it was argued that the real solution is to have the clients have a shorter timeout than the server so there are not routinely being killed. There is an open issue for how to handle lost database connections more gracefully: #672. But perspective is more how to handle database restarts and network interruptions than trying to work around _interesting_ server timeout settings.
Regarding context cancellation during connection, pgx should respect context through the entire connection process.
And as far as the race condition on context cancellation during a a query, pgx is not susceptible for two reasons.
Thanks for the detailed analysis!
Most helpful comment
Regarding lost connections:
I agree with some of the dissent on the original MySQL issue https://github.com/go-sql-driver/mysql/issues/657 where it was argued that the real solution is to have the clients have a shorter timeout than the server so there are not routinely being killed. There is an open issue for how to handle lost database connections more gracefully: #672. But perspective is more how to handle database restarts and network interruptions than trying to work around _interesting_ server timeout settings.
Regarding context cancellation during connection, pgx should respect context through the entire connection process.
And as far as the race condition on context cancellation during a a query, pgx is not susceptible for two reasons.