Skip to content

Socket async cancellation and timeout during connection #2860

Closed

Description

@roji

The connector's Connect method doesn't set the socket timeout, so if there's a network failure right during connection we may end up blocking forever.

Take this opportunity to also look at the async path, and to make sure the connection timeout is enforced there as well.

Activity

  1. added this to the 5.0 milestone on Feb 21, 2020
  2. self-assigned this
    on Feb 21, 2020
  3. roji commented on Sep 17, 2020

    @roji
    MemberAuthor

    @vonzshik another timeout-related issue just in case you're interested :)

  4. vonzshik commented on Sep 17, 2020

    @vonzshik
    Contributor

    @roji while I don't mind taking this one, it might take a little more effort than just setting the timeout for the connection, as we're also missing it for the authentication part. But I'll do my best to get it done for the 5.0 release.

  5. roji commented on Sep 18, 2020

    @roji
    MemberAuthor

    No problem @vonzshik! I'll clear the assignee, if you see you're not getting around to it for 5.0, I can try to work on it too. Let's see later.

  6. removed their assignment
    on Sep 18, 2020
  7. roji commented on Sep 20, 2020

    @roji
    MemberAuthor

    Note: thanks to dotnet/runtime#40750, we can do both cancellation and timeout (via cancellation) in Socket.ConnectAsync.

  8. vonzshik commented on Sep 20, 2020

    @vonzshik
    Contributor

    Woohoo!

  9. self-assigned this
    on Sep 20, 2020
  10. roji commented on Sep 20, 2020

    @roji
    MemberAuthor

    @vonzshik I'm adding support for this, a PR will be up shortly. I'm going to scope this issue to track specifically ConnectAsync, and have opened #3166 to track any remaining cancellation-related tasks (which you're welcome to take a look at).

  11. added a commit that references this issue on Sep 20, 2020
    62d1f7c
  12. added a commit that references this issue on Sep 20, 2020
    83e8d90
  13. changed the title [-]Socket timeout not set during connection[/-] [+]Socket async cancellation and timeout during connection[/+] on Sep 20, 2020
  14. added theissue type on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions