fix: Use context.Background() in client constructors#5897
Merged
franciscojavierarceo merged 1 commit intofeast-dev:masterfrom Jan 23, 2026
Merged
Conversation
Signed-off-by: samuelkim7 <samuel.kim@goflink.com>
edb526a to
02fe5d6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical context cancellation bug in cloud client constructors that caused immediate failures when the Go feature server attempted to connect to GCS, S3, and DynamoDB resources. The issue stemmed from using context.WithTimeout() with defer cancel() in constructors, which prematurely canceled the context before the long-lived clients could perform their first operations.
Changes:
- Replaced
context.WithTimeout()withcontext.Background()in client constructors to align client lifecycle with server uptime - Refactored variable naming in S3RegistryStore from
lrtorsfor consistency with GCS implementation - Applied the fix across GCS Registry Store, S3 Registry Store, and DynamoDB Online Store for architectural consistency
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go/internal/feast/registry/s3.go | Changed S3 client constructor to use context.Background() and renamed variable from lr to rs for consistency |
| go/internal/feast/registry/gcs.go | Changed GCS client constructor to use context.Background() instead of timeout context |
| go/internal/feast/onlinestore/dynamodbonlinestore.go | Changed DynamoDB client constructor to use context.Background() instead of timeout context |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
franciscojavierarceo
approved these changes
Jan 23, 2026
YassinNouh21
pushed a commit
to YassinNouh21/feast
that referenced
this pull request
Feb 7, 2026
Signed-off-by: samuelkim7 <samuel.kim@goflink.com> Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
YassinNouh21
pushed a commit
to YassinNouh21/feast
that referenced
this pull request
Feb 7, 2026
Signed-off-by: samuelkim7 <samuel.kim@goflink.com> Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
franciscojavierarceo
pushed a commit
that referenced
this pull request
Feb 17, 2026
# [0.60.0](v0.59.0...v0.60.0) (2026-02-17) ### Bug Fixes * Added a flag to correctly download the go binaries ([0f77135](0f77135)) * Adds mapping of date Trino's type into string Feast's type ([531e839](531e839)) * **ci:** Use uv run for pytest in master_only benchmark step ([#5957](#5957)) ([5096010](5096010)) * Disable materialized odfvs for historical retrieval ([#5880](#5880)) ([739d28a](739d28a)) * Fix linting and formatting issues ([#5907](#5907)) ([42ca14a](42ca14a)) * Make timestamp field handling compatible with Athena V3 ([#5936](#5936)) ([e2bad34](e2bad34)) * Support pgvector under non-default schema ([#5970](#5970)) ([c636cd4](c636cd4)) * unit tests not running on main branch ([#5909](#5909)) ([62fe664](62fe664)) * Update java dep which blocking release ([#5903](#5903)) ([a5b8186](a5b8186)) * Update the dockerfile with golang 1.24.12. ([#5918](#5918)) ([be1b522](be1b522)) * Use context.Background() in client constructors ([#5897](#5897)) ([984f93a](984f93a)) ### Features * Add blog post for PyTorch ecosystem announcement ([#5906](#5906)) ([d2eb629](d2eb629)) * Add blog post on Feast dbt integration ([#5915](#5915)) ([b3c8138](b3c8138)) * Add DynamoDB in-place list update support for array-based features ([#5916](#5916)) ([aa5973f](aa5973f)) * Add HTTP connection pooling for remote online store client ([#5895](#5895)) ([e022bf8](e022bf8)) * Add integration tests for dbt import ([#5899](#5899)) ([a444692](a444692)) * Add lazy initialization and feature service caching ([#5924](#5924)) ([b37b7d0](b37b7d0)) * Add multiple entity support to dbt integration ([#5901](#5901)) ([05a4fb5](05a4fb5)), closes [#5872](#5872) * Add PostgreSQL online store support for Go feature server ([#5963](#5963)) ([b8c6f3d](b8c6f3d)) * Add publish docker image of Go feature server. ([#5923](#5923)) ([759d8c6](759d8c6)) * Add Set as feature type ([#5888](#5888)) ([52458fc](52458fc)) * Added online server worker config support in operator ([#5926](#5926)) ([193c72a](193c72a)) * Added support for OpenLineage integration ([#5884](#5884)) ([df70d8d](df70d8d)) * Adjust ray offline store to support abfs(s) ADLS Azure Storage ([#5911](#5911)) ([d6c0b2d](d6c0b2d)) * Batch_engine config injection in feature_store.yaml through operator ([#5938](#5938)) ([455d56c](455d56c)) * Consolidate Python packaging - remove setup.py/setup.cfg, standardize on pyproject.toml and uv ([16696b8](16696b8)) * **go:** Add MySQL registry store support for Go feature server ([#5933](#5933)) ([19f9bb8](19f9bb8)) * Improve local dev experience with file-aware hooks and auto parallelization ([#5956](#5956)) ([839b79e](839b79e)) * Modernize precommit hooks and optimize test performance ([#5929](#5929)) ([ea7d4fa](ea7d4fa)) * Optimize container infrastructure for production ([#5881](#5881)) ([5ebdac8](5ebdac8)) * Optimize DynamoDB online store for improved latency ([#5889](#5889)) ([fcc8274](fcc8274))
soooojinlee
pushed a commit
to soooojinlee/feast
that referenced
this pull request
Feb 18, 2026
# [0.60.0](feast-dev/feast@v0.59.0...v0.60.0) (2026-02-17) ### Bug Fixes * Added a flag to correctly download the go binaries ([0f77135](feast-dev@0f77135)) * Adds mapping of date Trino's type into string Feast's type ([531e839](feast-dev@531e839)) * **ci:** Use uv run for pytest in master_only benchmark step ([feast-dev#5957](feast-dev#5957)) ([5096010](feast-dev@5096010)) * Disable materialized odfvs for historical retrieval ([feast-dev#5880](feast-dev#5880)) ([739d28a](feast-dev@739d28a)) * Fix linting and formatting issues ([feast-dev#5907](feast-dev#5907)) ([42ca14a](feast-dev@42ca14a)) * Make timestamp field handling compatible with Athena V3 ([feast-dev#5936](feast-dev#5936)) ([e2bad34](feast-dev@e2bad34)) * Support pgvector under non-default schema ([feast-dev#5970](feast-dev#5970)) ([c636cd4](feast-dev@c636cd4)) * unit tests not running on main branch ([feast-dev#5909](feast-dev#5909)) ([62fe664](feast-dev@62fe664)) * Update java dep which blocking release ([feast-dev#5903](feast-dev#5903)) ([a5b8186](feast-dev@a5b8186)) * Update the dockerfile with golang 1.24.12. ([feast-dev#5918](feast-dev#5918)) ([be1b522](feast-dev@be1b522)) * Use context.Background() in client constructors ([feast-dev#5897](feast-dev#5897)) ([984f93a](feast-dev@984f93a)) ### Features * Add blog post for PyTorch ecosystem announcement ([feast-dev#5906](feast-dev#5906)) ([d2eb629](feast-dev@d2eb629)) * Add blog post on Feast dbt integration ([feast-dev#5915](feast-dev#5915)) ([b3c8138](feast-dev@b3c8138)) * Add DynamoDB in-place list update support for array-based features ([feast-dev#5916](feast-dev#5916)) ([aa5973f](feast-dev@aa5973f)) * Add HTTP connection pooling for remote online store client ([feast-dev#5895](feast-dev#5895)) ([e022bf8](feast-dev@e022bf8)) * Add integration tests for dbt import ([feast-dev#5899](feast-dev#5899)) ([a444692](feast-dev@a444692)) * Add lazy initialization and feature service caching ([feast-dev#5924](feast-dev#5924)) ([b37b7d0](feast-dev@b37b7d0)) * Add multiple entity support to dbt integration ([feast-dev#5901](feast-dev#5901)) ([05a4fb5](feast-dev@05a4fb5)), closes [feast-dev#5872](feast-dev#5872) * Add PostgreSQL online store support for Go feature server ([feast-dev#5963](feast-dev#5963)) ([b8c6f3d](feast-dev@b8c6f3d)) * Add publish docker image of Go feature server. ([feast-dev#5923](feast-dev#5923)) ([759d8c6](feast-dev@759d8c6)) * Add Set as feature type ([feast-dev#5888](feast-dev#5888)) ([52458fc](feast-dev@52458fc)) * Added online server worker config support in operator ([feast-dev#5926](feast-dev#5926)) ([193c72a](feast-dev@193c72a)) * Added support for OpenLineage integration ([feast-dev#5884](feast-dev#5884)) ([df70d8d](feast-dev@df70d8d)) * Adjust ray offline store to support abfs(s) ADLS Azure Storage ([feast-dev#5911](feast-dev#5911)) ([d6c0b2d](feast-dev@d6c0b2d)) * Batch_engine config injection in feature_store.yaml through operator ([feast-dev#5938](feast-dev#5938)) ([455d56c](feast-dev@455d56c)) * Consolidate Python packaging - remove setup.py/setup.cfg, standardize on pyproject.toml and uv ([16696b8](feast-dev@16696b8)) * **go:** Add MySQL registry store support for Go feature server ([feast-dev#5933](feast-dev#5933)) ([19f9bb8](feast-dev@19f9bb8)) * Improve local dev experience with file-aware hooks and auto parallelization ([feast-dev#5956](feast-dev#5956)) ([839b79e](feast-dev@839b79e)) * Modernize precommit hooks and optimize test performance ([feast-dev#5929](feast-dev#5929)) ([ea7d4fa](feast-dev@ea7d4fa)) * Optimize container infrastructure for production ([feast-dev#5881](feast-dev#5881)) ([5ebdac8](feast-dev@5ebdac8)) * Optimize DynamoDB online store for improved latency ([feast-dev#5889](feast-dev#5889)) ([fcc8274](feast-dev@fcc8274)) Signed-off-by: soojin <soojin@dable.io>
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.
What this PR does / why we need it:
This PR fixes a critical
context canceledbug in the GCS/S3 RegistryStore and DynamoDB OnlineStore constructors.The Bug: Immediate Context Cancellation
During testing with the Go feature server (running in a local Docker container) connected to live cloud infrastructure (GCS, Redis), the following error occurred immediately upon startup:
{"level":"error","error":"Get \"https://storage.googleapis.com/.../feature_registry.db\": Post \"https://oauth2.googleapis.com/token\": context canceled", "message":"Registry refresh Failed"}Root Cause
In the previous implementation, the constructor (NewGCSRegistryStore) initialized cloud clients using
context.WithTimeout()anddefer cancel(). Becausecancel()is called immediately when the constructor returns, the base context for the GCS client becomes invalidated. This leads to an immediate failure when the client attempts to perform its first operation (like fetching an OAuth token or reading the registry), even if the 5-second timeout hasn't elapsed.The Fix: Lifecycle Alignment
A storage client's lifecycle should be tied to the server's uptime.
context.Background(). This ensures the client's underlying connection and token-refresh routines remain valid as long as the server is running.context.WithTimeout()inside individual methods (GetRegistryProto, Teardown). This correctly applies a deadline to specific I/O operations without killing the persistent client.This follows Go's recommended practice of not storing or canceling request-scoped contexts in long-lived objects.
Consistency
To ensure architectural consistency across the project and prevent similar latent bugs, this fix has been applied to:
Which issue(s) this PR fixes:
Fixes the
context cancelederror that prevents the Go feature server from properly connecting to live cloud registries and online stores.Misc
Refactored internal variable names (changing
lrtorsin NewS3RegistryStore) to align with the naming conventions used in gcs.go and to accurately reflect their purpose as RegistryStore.