-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aiopg times out while attempting to connect if falling back to an IPv4 address #907
Comments
I can replicate this with vanilla Postgres & The difference is that PG listens, by default, to "
My CockroachDB instance, OTOH, is bound to We can replicate this with vanilla PG by binding to (in
And then some slight tweaks to the example: A slightly different exampleimport argparse
import asyncio
import logging
from pathlib import Path
import aiopg
async def test_db_pool(dbname: str, username: str, certs: Path):
logging.info('Creating test connection.')
kwargs = {
'host': 'localhost',
#'port': 26257,
'port': 5432,
'dbname': dbname,
#'user': username,
'user': 'my-username',
#'sslmode': 'verify-full',
#'sslcert': certs / f'client.{username}.crt',
#'sslkey': certs / f'client.{username}.key',
#'sslrootcert': certs / 'ca.crt',
}
async with aiopg.connect(**kwargs) as pool:
logging.info('Connection ready.')
def main():
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser()
parser.add_argument('--certs-dir', action='store')
args = parser.parse_args()
asyncio.run(test_db_pool('postgres', 'root', Path(args.certs_dir)))
if __name__ == '__main__':
main() Now knowing this, we can get back to Cockroach: I had been passing But it's "falling back to attempting to connect over IPv4" that is the critical bit, not Cockroach. |
My working theory on this issue is that We need to call Lines 835 to 840 in 7b01833
I think the "problem" is that I added some debugging to see when
I'm not 100% convinced of this yet. Even if it's correct … boy do I not know how we're to fix it! It seems like the interface w/ PG doesn't give us the info we need to know that the FD has been swapped out. It's all good and fine if you're using |
Describe the bug
While attempting to connect to CockroachDB,
aiopg
raisesTimeoutError
.To Reproduce
localhost
. I am running v22.2.19 on Linux.Expected behavior
The example exits successfully.
Logs/tracebacks
Python Version
aiopg Version
OS
Arch Linux
Additional context
Cockroach is a distributed database that uses the PostgreSQL wire protocol for queries.
psql
is capable of connecting to it, and executing queries. (So ispsycopg2
.)When running the example, there is a long pause after
Creating test connection.
, approximately 60s.aiopg
worked a few CockroachDB versions prior to this one, but I am sorry, I did not record the working version's number.A packet captures shows
aiopg
makes the connection (the 3-way handshake happens) but no data is ever transmitted. This is a bit surprising, since at this point I am not sure what Cockroach could have done to have acted differently from vanilla PG.Code of Conduct
The text was updated successfully, but these errors were encountered: