Repository navigation
Stop leaking a telemetry collector on every final flush - #1800
Open
vuanhphung wants to merge 2 commits into
Open
vuanhphung wants to merge 2 commits into
vuanhphung wants to merge 2 commits into
Conversation
TelemetryClient.close() called getOrCreateCollector() for the connection it was created with. By then that connection had closed and its collector had been removed, so close() created a new, empty one that was never removed: one leaked collector (and the connection context it holds) per close of a host's last connection. Remove the collector instead and export it only if it is still there. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
1 of 3 tasks
Resolve the main changes by merging (no force-push). Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
This branch has not been deployed
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.
Description
TelemetryClient.close()runs when the last connection to a host closes, and it calledgetOrCreateCollector()for the connection the client was created with. That connection had already closed, and its collector had already been removed, soclose()created a new, empty collector that was never removed. Each one keeps its connection context alive. On main, 20 sequential open/close cycles against a real warehouse leave 20 entries inTelemetryCollectorManager, so apps that open a connection per query grow without bound.close()now removes the collector instead and exports it only if one is still there. Export behavior does not change.#1798 contains the same hunk, because its close-race test checks that no per-connection state is left behind. The hunks are identical, so the two PRs merge cleanly in either order; only
NEXT_CHANGELOG.mdneeds a trivial rebase.Testing
Two new
TelemetryClientTestcases fail on main:close()leaves no collector for the closed connection, and a collector with pending details is still exported and then removed.TelemetryClientTest,TelemetryClientFactoryTestandTelemetryCollectorManagerTestpass. The fulljdbc-coresuite (3,881 tests) has one failure,ArrowBufferAllocatorTest.testCreateDatabricksBufferAllocator, which also fails on main.Telemetry Errors
DatabricksDriverErrorCodewhere appropriate, and anynew code is uniquely numbered and tested.
requested because the author cannot access the classification.
This pull request and its description were written by Isaac.