Skip to content

ConnectionBalancer Bug #16113

Closed
Closed

Description

@dmsqls

Hi. Report a bug in ConnectionBalancer

When pickTargetHandler is called, Count 1 increases as shown below.

BalancedConnectionHandler&
ExactConnectionBalancerImpl::pickTargetHandler(BalancedConnectionHandler&) {
--- skip ---
    min_connection_handler->incNumConnections();             ///< increment connection count
  }

  return *min_connection_handler;
}

However, the connection count is always 0, and the connection balancer is not processed as expected. (See log below)

[DEBUG] WORKER[0] CONNECTION COUNT[0]
[DEBUG] WORKER[1] CONNECTION COUNT[0]
[DEBUG] incNumConnections!!!!!!            ///< increment count 1
[DEBUG] decNumConnections!!!!!!           ///< decrement ??
[DEBUG] incNumConnections!!!!!!           ///< increment count 1 ???
///< next connection receive
[DEBUG] WORKER[0] CONNECTION COUNT[0]      //< why 0???
[DEBUG] WORKER[1] CONNECTION COUNT[0]
[DEBUG] incNumConnections!!!!!!
[DEBUG] decNumConnections!!!!!!
[DEBUG] incNumConnections!!!!!!

Temporarily modified as follows and it resolved.

BalancedConnectionHandler&
ExactConnectionBalancerImpl::pickTargetHandler(BalancedConnectionHandler&) {
--- skip ---
    min_connection_handler->incNumConnections();
#ifdef _BUG_CONN_BALANCER_ 
    min_connection_handler->incNumConnections();            ///< add
#endif

  }

  return *min_connection_handler;
}

Please review.

Thanks.

Reference information

Envoy Binary Version
./envoy version: 430fb4cd4004831170885184066045a3902acc4b/1.17.0/Modified/RELEASE/BoringSSL

Configuration

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: test-filter
  namespace: istio-system
spec:
  configPatches:
  - applyTo: LISTENER
    match:
      context: SIDECAR_OUTBOUND
      listener: {}
    patch:
      operation: MERGE
      value:
        connection_balance_config:
          exact_balance: {}

Activity

  1. added
    triage
    on Apr 22, 2021
  2. mattklein123 commented on Apr 22, 2021

    @mattklein123
    Member

    cc @lambdai I think this is the bug you are currently fixing?

  3. added and removed
    triage
    on Apr 23, 2021
  4. dmsqls commented on Apr 26, 2021

    @dmsqls
    Author

    cc @lambdai I think this is the bug you are currently fixing

    No, I'm not currently fixing it.

  5. lambdai commented on Apr 26, 2021

    @lambdai
    Contributor

    @dmsqls Thanks for the analysis.
    Will be fixed by #15842

    Before the fix, only the balance depends on the connections owned by the virtualoutbound listener. The number of connections is usually 0 there.
    With my fix and the envoy filer crd, the connection will be balanced as your expectation

  6. dmsqls commented on Apr 27, 2021

    @dmsqls
    Author

    Thank you. It works as expected. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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