Skip to content

Break the connection when sync cancellation fails #3187

Description

@roji

With our new cancellation logic, when the user triggers a cancellation token (or CommandTimeout is reached), we attempt a PG cancellation. In async, if the PG cancellation itself fails (e.g. failure to connect because of a network partition), we immediately break the (main command's) connection.

We should look into doing the same for sync cancellation. We can't trigger a cancellation token, but IIRC it's OK to forcibly close the socket - this should immediately terminate any I/O operation stuck on that socket. This of course needs testing - and I'm not sure which exception gets thrown on the read side - but it would align sync and async behavior and is generally useful.

/cc @vonzshik

Activity

  1. added this to the 5.0.0 milestone on Sep 25, 2020
  2. vonzshik commented on Sep 25, 2020

    @vonzshik
    Contributor

    As of right now, it does seem reasonable for me. But there would be the same problem we've discussed at #1323.

  3. roji commented on Sep 25, 2020

    @roji
    MemberAuthor

    You're right, this is another instance of some concurrent/unrelated thing that suddenly breaks the connector as reading is taking place. Good to note this scenario in #1323 as well.

  4. vonzshik commented on Sep 27, 2020

    @vonzshik
    Contributor

    This of course needs testing - and I'm not sure which exception gets thrown on the read side - but it would align sync and async behavior and is generally useful.

    Just checked for for .net core 3.1 - we get IOException with a message "A blocking operation was interrupted by a call to WSACancelBlockingCall.", and with an inner exception SocketException with the same message.

  5. roji commented on Oct 25, 2020

    @roji
    MemberAuthor

    @vonzshik this is done, right?

  6. vonzshik commented on Oct 26, 2020

    @vonzshik
    Contributor

    @roji nope, not yet.

  7. roji commented on Nov 13, 2020

    @roji
    MemberAuthor

    @vonzshik I propose we leave this for 6.0 - we will have cancellation-related leftovers in any way, does that sound OK?

  8. vonzshik commented on Nov 13, 2020

    @vonzshik
    Contributor

    ok

  9. modified the milestones: 5.0.0, vNext on Nov 13, 2020
  10. modified the milestones: 6.0.0, Backlog on Oct 5, 2021
  11. added theissue type on Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions