Skip to content

Conversation

@thomasjpfan
Copy link
Contributor

@thomasjpfan thomasjpfan commented Oct 28, 2025

Describe your changes

This async function used socket.create_connection which is blocking. This PR introduces an async version of socket.create_connection with ``async.create_connection` and uses that instead.

Checklists

Compatibility checklist

Check these boxes or delete any item (or this section) if not relevant for this PR.

  • Client+Server: this change is compatible with old servers
  • Client forward compatibility: this change ensures client can accept data intended for later versions of itself

Note on protobuf: protobuf message changes in one place may have impact to
multiple entities (client, server, worker, database). See points above.


Release checklist

If you intend for this commit to trigger a full release to PyPI, please ensure that the following steps have been taken:

  • Version file (modal_version/__init__.py) has been updated with the next logical version
  • Changelog has been cleaned up and given an appropriate subhead


Note

Introduce an async port-check helper and replace the blocking socket check in Flash heartbeat with asyncio-based connectivity checks, adding targeted tests.

  • Utilities (modal/_utils/async_utils.py):
    • Add async helper is_port_connection_open(host, port, timeout) using asyncio.open_connection.
  • Flash (modal/experimental/flash.py):
    • Use is_port_connection_open in _FlashManager.is_port_connection_healthy instead of blocking socket.create_connection.
    • Minor adjustments: add brief sleeps while waiting, broaden exception handling to include asyncio.TimeoutError.
  • Tests (test/async_utils_test.py):
    • Add tests test_is_port_connection_open and test_is_port_connection_open_failure.

Written by Cursor Bugbot for commit 0d52553. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

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 this pull request may close these issues.

2 participants