Repository navigation
[surfacers.otel] Pass the allocated tls.Config to UpdateTLSConfig - #1495
Merged
Merged
Conversation
Both exporter branches allocated a tls.Config but then passed nil to tlsconfig.UpdateTLSConfig. UpdateTLSConfig writes to its first argument as soon as any config field is set, so a tls_config block that set anything (disable_cert_validation, ca_cert_file, tls_cert_file, server_name, min_tls_version) panicked at startup. An empty tls_config block didn't panic, but the exporter was built from an empty tls.Config. Fixes #1493.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both OTEL exporter branches allocated a
tls.Configbut then passedniltotlsconfig.UpdateTLSConfig.UpdateTLSConfigwrites to its first argument as soon as any config field is set (common/tlsconfig/tlsconfig.go:67), so this had two failure modes:tls_configsetdisable_cert_validation,ca_cert_file,tls_cert_file,server_name, ormin_tls_version.tls_config {}was present but empty — nothing was dereferenced, and the exporter was built from an emptytls.Config.Both branches now pass
tlsConfig.Tests: three cases added to
TestGetExporterType— HTTP and gRPC exporters withdisable_cert_validation: true, plus a gRPC case with a non-existentca_cert_fileto cover the error path. The first two panic against the pre-fix code (SIGSEGV attlsconfig.go:67, matching the trace in the issue) and pass after it.Note: neither
otlpmetrichttp.Exporternorotlpmetricgrpc.Exporterexposes the TLS config it was built with, so the test asserts the exporter is constructed without panicking or erroring rather than that the settings reach the wire.UpdateTLSConfig(nildoes not appear anywhere else in the tree.Fixes #1493.