Skip to content
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

BlockingIOConnection doesn't support IPV6 #486

Closed
cmr-a opened this issue Apr 3, 2024 · 2 comments · Fixed by #499
Closed

BlockingIOConnection doesn't support IPV6 #486

cmr-a opened this issue Apr 3, 2024 · 2 comments · Fixed by #499

Comments

@cmr-a
Copy link

cmr-a commented Apr 3, 2024

Describe the bug
BlockingIOConnection throws when you try to connect to an IPv6 address

Reproduction

import edgedb

client = edgedb.create_client(dsn="edgedb://edgedb:edgedb@[::1]:5656/edgedb")
client.ensure_connected()

Produces:

gaierror                                  Traceback (most recent call last)
File [ ~/venv/site-packages/edgedb/blocking_client.py:52], in BlockingIOConnection.connect_addr(self, addr, timeout)
     [57] try:
---> [58]     sock.connect(addr)
     [60]     if not isinstance(addr, str):

gaierror: [Errno -9] Address family for hostname not supported

...

The exception is thrown here:

sock.connect(addr)

Expected behavior
Connection established / connection refused

Versions (please complete the following information):

  • OS: Linux
  • EdgeDB version: N/A
  • EdgeDB CLI version: 4.0.2
  • edgedb-python version: 1.9.0
  • Python version: 3.11.8

Additional context
Other IPv6 addresses produce the same error, nothing special about [::1].

No problems with asyncio_client.

I was able to fix blocking_client.py with:

        if isinstance(addr, str):
            # UNIX socket
            sock = socket.socket(socket.AF_UNIX)
        else:
            if ":" in addr[0]:
                sock = socket.socket(socket.AF_INET6)
            else:
                sock = socket.socket(socket.AF_INET)

I don't know if this is the right way to fix it, but it allowed the connection to be established.

@cmr-a cmr-a changed the title BlockingIOConnection doesn't work with IPV6 BlockingIOConnection doesn't support IPV6 Apr 4, 2024
@zachary822
Copy link
Contributor

This new branch should fix the issue. Can you give it a try?

@cmr-a
Copy link
Author

cmr-a commented May 11, 2024

It works, thanks!

@cmr-a cmr-a closed this as completed May 11, 2024
@fantix fantix reopened this May 29, 2024
fantix added a commit that referenced this issue Jun 19, 2024
New Features
============

* Support EdgeDB 5.0 "branch" connection option
  (by @vpetrovykh in #484 #485 #487)

* Support EdgeDB 5.0 AI extension
  (by @fantix in #489 #490)

Breaking Changes
================

* Enum values can now compare to user-defined enums successfully (#425)
  (by @fantix in bb7522c for #419)

* Add optional default to codegen params (#426)
  (by @fantix in 21b024a for #422)

Changes
=======

* blocking client: fix connect and timeout, support IPv6 (#499)
  (by @fantix @zachary822 in 28a83fd for #486)

Fixes
=====

* Add test to check setting a computed global using with_globals. (#494)
  (by @dnwpark in 636bc0e for #494)

* Fix test and add Python 3.12 in CI
  (by @fantix in #498 #503)

* Use result of pydantic_dataclass, will silence linters (#501)
  (by @AdrienPensart in d88187a)

* Extract ExecuteContext as in/out argument (#500)
  (by @fantix in 2fb7965 for #493)
fantix added a commit that referenced this issue Jun 19, 2024
New Features
============

* Support EdgeDB 5.0 "branch" connection option
  (by @vpetrovykh in #484 #485 #487)

* Support EdgeDB 5.0 AI extension
  (by @fantix in #489 #490)

Breaking Changes
================

* Enum values can now compare to user-defined enums successfully (#425)
  (by @fantix in bb7522c for #419)

* Add optional default to codegen params (#426)
  (by @fantix in 21b024a for #422)

Changes
=======

* blocking client: fix connect and timeout, support IPv6 (#499)
  (by @fantix @zachary822 in 28a83fd for #486)

Fixes
=====

* Add test to check setting a computed global using with_globals. (#494)
  (by @dnwpark in 636bc0e for #494)

* Fix test and add Python 3.12 in CI
  (by @fantix in #498 #503)

* Use result of pydantic_dataclass, will silence linters (#501)
  (by @AdrienPensart in d88187a)

* Extract ExecuteContext as in/out argument (#500)
  (by @fantix in 2fb7965 for #493)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants