Skip to content

ConnectionPool not releasing semaphore #229

Closed

Description

@oldani

I'm trying to figure this out and find a fix for this as for right now. To be on context I'm using httpx for microservice communication, some hours ago I started getting PoolTimeout error on sentry at first I thought about increasing the PooLimit but when I took a look at metrics I was just hitting 0.5 rq/s so I added some logs.

When the error is raised dispatch.num_connections is between 4 & 0 while dispatch.max_connections.semaphore._value is 0 and the timeout get raised. So somewhere connections are being dropped but the semaphore is not being increased.

Activity

  1. sethmlarson commented on Aug 17, 2019

    @sethmlarson
    Contributor

    I'll investigate, is this with 0.7.0?

  2. oldani commented on Aug 17, 2019

    @oldani
    ContributorAuthor

    Version is 0.6.8 I'm on it as right now my guess is around https://github.com/encode/httpx/blob/master/httpx/dispatch/connection_pool.py#L121

  3. oldani commented on Aug 17, 2019

    @oldani
    ContributorAuthor

    Yeah, it's actually the ConnectionPool I make a path and deployed it's no longer happening I will open a PR.

    Basically, when you call acquire_connection and a new connection is created you acquire the semaphore but when you pop up that connection and check if it's dropped you need to release the semaphore otherwise it will keep decreasing until it reaches zero and the app starts crashing.

  4. reopened this on Aug 17, 2019
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions