Skip to content

Make an exception for a timeout of a sync query the same way as for an async one #3132

Closed

Description

@vonzshik

Per request from #3130

Right now, if ReadBuffer fails with a timeout for a sync query, we get NpgsqlException with an inner exception as IOException with another inner exception as SocketException. And after that, you have to check SocketErrorCode of SocketException on a correct code (and don't forget about bug in Mono, where it throws SocketException with the wrong error).

I think it's reasonable to throw NpgsqlException with an inner exception as TimeoutException, and inside of TimeoutException have IOException as inner exception. We already have the same behavior for async queries.

@YohDeadfall @Brar maybe you have some objections?

Activity

  1. roji commented on Sep 8, 2020

    @roji
    Member

    FWIW I wonder if the mono bug is still there, this may be a leftover from a long time ago (we don't run the tests on mono in CI)

  2. vonzshik commented on Sep 8, 2020

    @vonzshik
    ContributorAuthor

    So you're saying we might have a bug with the timeouts for sync queries for the mono

  3. roji commented on Sep 9, 2020

    @roji
    Member

    Yeah, although it would affect only a pretty narrow scenario (timeout during synchronous NpgsqlConnection.Wait), opened #3135 to track.

    This is making me think of this: #1330 (comment) 🤣

  4. vonzshik commented on Sep 9, 2020

    @vonzshik
    ContributorAuthor

    FWIW I wonder if the mono bug is still there, this may be a leftover from a long time ago (we don't run the tests on mono in CI)

    It seems, it's still there and wouldn't be fixed.

  5. added this to the 5.0 milestone on Sep 12, 2020
  6. roji commented on Sep 13, 2020

    @roji
    Member

    @vonzshik that issue seems to discuss the text message in the exception, which is quite different from a bad SocketErrorCode...

    In any case, the bug is still there - I've reproduced it and filed mono/mono#20381 to track.

  7. 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

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions