Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No redundant extension download #38

Merged
merged 5 commits into from
Apr 6, 2024
Merged

Conversation

elefeint
Copy link
Contributor

@elefeint elefeint commented Apr 6, 2024

So, the memory leak was not a memory leak. It was a simultaneous attempt to download multiple identical extensions. This was wasteful, but it also temporarily caused a memory spike.

This does not show up in non-containerized environment because DuckDB extensions get cached in ~/.duckdb directory. But in a containerized environment, whenever a new container starts, it has no local copy of the extensions. When combined with multiple simultaneous Describe / Truncate calls, this resulted in multiple attempts to download a (statically linked, 350 MB) Linux extension.

This PR (which I will absolutely cowboy-weekend-merge without review) installs and loads motherduck extension on gRPC server startup, before the server is ready to accept connections. INSTALL downloads the wrapper, and LOAD downloads the latest extension payload. So by the time real requests come in, the extension is pre-downloaded.

There can still be a similar problem if there is a running container that gets simultaneous requests right after our weekly production release, but this should recover through Fivetran's normal connector retry mechanisms.

@elefeint elefeint merged commit 1650658 into main Apr 6, 2024
1 check passed
@elefeint elefeint deleted the no_redundant_extension_download branch April 6, 2024 22:10
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.

1 participant