Skip to content

Connection leak - CircuitBreak Filter + Chunked 500 Response #3978

@tiliveanic

Description

@tiliveanic

Describe the bug
When combining the Circuit Break Filter configured with a 500 status code & a fallback - when the SCG receives a 'slow' chunked 500 response from the upstream, it fallbacks and, as a side-effect, it will leak a connection towards the first upstream, eventually leading to connection pool exhaustion & essentially block of the routes.

Sample
Here is the routes config :

       - id: cbroute
          predicates:
            - 'Path=/chunked/delayed'
          uri: 'https://first.com'
          filters:
            - name: CircuitBreaker
              args:
                name: lfs-cb
                fallbackUri: 'forward:/fallback'
                statusCodes: '500'
        - id: cbfallback
          predicates:
            - 'Path=/fallback'
          uri: 'https://second.com'
          filters:
            - 'SetPath=/one'

When the chunked response comes fast enough the issue does not reproduce.

Here is a repo with the reproduction scenario using WireMock
https://github.com/tiliveanic/scg-cb-chunked-bug

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions