Skip to content

Connector lock not acquired when changing state to Fetching #1502

Open

Description

@roji

Raised by @Emill in gitter.

The connector state should only be changed when the connector lock is acquired, otherwise race conditions can occur. This is usually the case, but NpgsqlDataReader changes the connector state to Fetching without acquiring the lock in ProcessMessage. This can lead to a race condition - if the connector is being broken while writing the command, and the user is reading via the NpgsqlDataReader, the Broken state can be overwritten by Fetching.

Even with this resolved, it's probably a good idea to assert that the connector lock is acquired by the current thread when trying to access the state.

Activity

  1. added this to the 3.2.2 milestone on Mar 19, 2017
  2. modified the milestones: 3.2.2, 3.2.3 on Mar 21, 2017
  3. modified the milestones: 3.2.3, 3.2.4 on May 31, 2017
  4. modified the milestones: 3.2.4, 3.2.5 on Jun 13, 2017
  5. 2 remaining items

  6. modified the milestones: , 3.2.5 on Jul 25, 2017
  7. modified the milestones: 4.0, on Mar 14, 2018
  8. modified the milestones: 4.1, 5.0 on Sep 8, 2019
  9. modified the milestones: 5.0, 6.0.0 on Sep 17, 2020
  10. modified the milestones: 6.0.0, 7.0.0 on Oct 3, 2021
  11. modified the milestones: 7.0.0, Backlog on Sep 11, 2022
  12. 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

Labels

No labels
No labels

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions