Results 359 comments of Jack Christensen

That really surprises me that PgBouncer would forward cancellations in that manner. It seems that it would be impossible to use that functionality safely. I would have expected PgBouncer to...

> and this client->cancel_key is generated for each client, it is not server cancel_key: I would expect pgx to only see the client cancel key then -- and pgbouncer be...

I just spent several hours digging into this and am unable to reproduce this... First, I wrote an example program that inspects that explicitly tries to create this problem. https://github.com/jackc/pgx_issues/blob/8eb2ebfc8b41c96c4a642e4d078c293f69af320c/main.go...

Here it is with the comments removed. ``` [databases] pgx_test = host=127.0.0.1 dbname=pgx_test [pgbouncer] logfile = /usr/local/var/log/pgbouncer.log pidfile = /usr/local/var/run/pgbouncer.pid listen_addr = 127.0.0.1 listen_port = 6432 auth_type = trust auth_file...

I was able to duplicate the problem using your example. But I don't think the cancel query that occurs when closing the connection is the problem. I experimented with removing...

> Do we really need to close the connection asynchronously? Well, I guess it depends on how we define "need". IMO, there are two requirements for context cancellation. 1. Context...

I am not aware of any changes regarding this issue between v4 and v5. But I haven't looked into either.

@roman-wb You probably want to use `BuildContextWatcherHandler` with `CancelRequestContextWatcherHandler` or `DeadlineContextWatcherHandler`.

> Please tell: what happen if we assign empty struct to BuildContextWatcherHandler? You would get a compile error... `BuildContextWatcherHandler` is a function that returns a `ctxwatch.Handler` not a struct. If...

The would make context cancellation a no-op. It would never send a cancel request and it would never set a deadline. A query could block forever.