Skip to content

gh-135836: Fix IndexError in asyncio.create_connection() #135875

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 24, 2025

It occurs when non-OSError exception is raised during connection and socket's close() raises OSError.

It occurs when non-OSError exception is raised during connection and socket's
close() raises OSError.
@serhiy-storchaka serhiy-storchaka force-pushed the asyncio-create_connection-indexerror branch from caa0472 to 2c7545f Compare June 24, 2025 08:10
sock.close()
try:
sock.close()
except OSError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if suppressing this error is correct here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is okay. It is an error in closing just created connection, it is less interesting than the original non-OSError error.

We do not even know what is this error, because we have no reproducer. ECONNRESET is already ignored in socket.close(). I suspect that this is similar error (maybe EINTR?) which should always be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants