Skip to content

sds: don't throw exceptions in initialize()#11223

Merged
htuch merged 6 commits into
envoyproxy:masterfrom
htuch:fix-c-ares-fuzz
May 27, 2020
Merged

sds: don't throw exceptions in initialize()#11223
htuch merged 6 commits into
envoyproxy:masterfrom
htuch:fix-c-ares-fuzz

Conversation

@htuch
Copy link
Copy Markdown
Member

@htuch htuch commented May 15, 2020

Similar root cause to #4377 - we can't throw exceptions in initialize().

Fixes #10976

Risk level: Low
Testing: Unit/integration test added.

Signed-off-by: Harvey Tuch htuch@google.com

Redux of envoyproxy#4377.

Fixes envoyproxy#10976

Risk level: Low
Testing: Unit/integration test added.

Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch htuch requested a review from snowp May 15, 2020 22:51
Copy link
Copy Markdown
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems right to me, just one comment

Comment thread test/common/secret/sds_api_test.cc Outdated
Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Copy Markdown
Member Author

htuch commented May 18, 2020

@snowp turns out there is a slight problem in moving the subscription config to the constructor. Check out this config fragment from one of the integration tests:

static_resources:
  clusters:
    - name: cluster_0
      connect_timeout: 5s
      transport_socket:
        name: envoy.transport_sockets.tls
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
          common_tls_context:
            tls_certificates:
              - certificate_chain:
                  filename: /b/f/w/bazel-out/k8-fastbuild/bin/test/integration/sds_dynamic_integration_test.runfiles/envoy/test/config/integration/certs/clientcert.pem
                private_key:
                  filename: /b/f/w/bazel-out/k8-fastbuild/bin/test/integration/sds_dynamic_integration_test.runfiles/envoy/test/config/integration/certs/clientkey.pem
            validation_context_sds_secret_config:
              name: validation_secret
              sds_config:
                api_config_source:
                  api_type: GRPC
                  grpc_services:
                    - envoy_grpc:
                        cluster_name: sds_cluster
      load_assignment:
        cluster_name: cluster_0
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: 127.0.0.1
                      port_value: 36887
    - name: sds_cluster
      connect_timeout: 5s
      http2_protocol_options:
        {}
      load_assignment:
        cluster_name: cluster_0
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: 127.0.0.1
                      port_value: 42657

cluster_0 refers to sds_cluster via its transport socket, but we see an error:

[2020-05-18 00:30:06.019][24][critical][main] [source/server/server.cc:99] error initializing configuration '/b/f/w/_tmp/d0a45f39a3cb27a1acdbf12470d6dce1/bootstrap.json': envoy.config.core.v3.ApiConfigSource must have a statically defined non-EDS cluster: 'sds_cluster' does not exist, was added via api, or is an EDS cluster

because sds_cluster is defined after cluster_0, with the check occurring before sds_cluster is processed.

I think the "cleanest" solution here might be to have ClusterManager be aware of the set of pending config fragments that are being considered for loading in the current stack frame, e.g. pendingClusters(), and have

void Utility::validateClusterName(const Upstream::ClusterManager::ClusterInfoMap& clusters,
be able to query this. WDYT?

@snowp
Copy link
Copy Markdown
Contributor

snowp commented May 19, 2020

I like that idea, hopefully it will future proof us against other new uses cases where we need to reference a static cluster.

htuch added 4 commits May 20, 2020 01:21
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Copy Markdown
Member Author

htuch commented May 25, 2020

@snowp this is now updated, PTAL.

Copy link
Copy Markdown
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@htuch htuch merged commit 8f4d759 into envoyproxy:master May 27, 2020
@htuch htuch deleted the fix-c-ares-fuzz branch May 27, 2020 14:15
htuch added a commit to htuch/envoy that referenced this pull request May 27, 2020
Signed-off-by: Harvey Tuch <htuch@google.com>
mattklein123 pushed a commit that referenced this pull request May 27, 2020
Signed-off-by: Harvey Tuch <htuch@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught exception when using filebased xDS and file doesn't exist

2 participants