Re: [PATCH] Fix hostaddr crash during non-blocking cancellation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Fix hostaddr crash during non-blocking cancellation
Date
Msg-id 4076738.1751568856@sss.pgh.pa.us
Whole thread Raw
In response to [PATCH] Fix hostaddr crash during non-blocking cancellation  (Jacob Champion <jacob.champion@enterprisedb.com>)
List pgsql-hackers
Jacob Champion <jacob.champion@enterprisedb.com> writes:
> A connection with only a hostaddr (no host) can't be cancelled via
> PQcreateCancel(), because we'll crash in emitHostIdentityInfo(). The
> problem is that the synthetic connhost entry we've created for
> cancellation has an incorrect type field, which causes the following
> code to make bad decisions if connhost[0].host is NULL:

I hadn't noticed (or maybe I forgot) this thread, so when the
same problem was reported at [1] I just went ahead and pushed the
submitted patch, which is only cosmetically different from your 0001.
Apologies for treading on your toes.

As for the question of how to test this sort of thing, I'm not
too excited about the narrow-gauge test case your 0002 proposes.
What I did for manual testing in [1] was to hack the postgres_fdw
tests to connect using hostaddr instead of the default.  I think
formalizing that sort of approach would yield much better coverage.
I don't have any specific ideas about how to do it, though.
Maybe get our tests to respond to an environment variable that
allows overriding the default choices of connection properties?

            regards, tom lane

[1] https://www.postgresql.org/message-id/flat/18974-575f02b2168b36b3%40postgresql.org



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] pg_upgrade failed with error - ERROR: column "a" in child table must be marked NOT NULL
Next
From: Justin Pryzby
Date:
Subject: Re: [HACKERS] pg_upgrade failed with error - ERROR: column "a" in child table must be marked NOT NULL