Skip to content

Fix ABOR while waiting for a data connection - #216

Closed
charan-rathore wants to merge 2 commits into
aio-libs:masterfrom
charan-rathore:fix-205-abor-data-connection-wait
Closed

charan-rathore wants to merge 2 commits into
aio-libs:masterfrom
charan-rathore:fix-205-abor-data-connection-wait

Conversation

@charan-rathore

Copy link
Copy Markdown

When ABOR arrives after a transfer command but before the data socket connects, the readiness decorator receives the cancellation outside the worker's abort handler. The server closes the control connection instead of acknowledging the abort.

Move the worker decorator outside the data-connection check for LIST, MLSD, STOR (including APPE), and RETR. Cancellation during the wait now sends the existing 426/226 responses. Also cancel and drain the readiness gather when its caller is cancelled, shielding each connection future so cancellation does not break subsequent transfers.

The regression tests use a real TCP server on IPv4 and IPv6. They check both response codes and a successful download on the same control connection after the abort. A timeout control checks that the existing 425 response and later transfer still work.

Closes #205.

Validation:

  • CPython 3.12.14: all 10 new abort cases fail on the unmodified server (ConnectionResetError); patched full suite: 804 passed.
  • Fresh-clone run_tests.sh on CPython 3.10.12: 10 baseline failures; patched suite: 798 passed, 1 skipped. Version-dependent test parametrization produces different totals.
  • Ruff check and format check passed on both runs; mypy passed.
  • Existing tests cover active-transfer aborts and no-work ABOR.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Fixes abort handling during data connection setup.

No outstanding findings block merging.

Reviews (3) · Last reviewed commit: "Give the abort test replies a 1 second d..."

Comment thread src/aioftp/server.py
Comment thread tests/test_abort.py Outdated
@charan-rathore

Copy link
Copy Markdown
Author

Closing for now since nothing has moved here. Happy to pick it back up if a maintainer wants it.

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.

ABOR during the data-connection wait sends no 426/226 acknowledgement and orphans the transfer

1 participant