Repository navigation
fix: Reuse an in-flight big segment status poll instead of querying twice - #460
Merged
Merged
Conversation
jsonbailey
marked this pull request as ready for review
October 5, 2026 14:51
jsonbailey
marked this pull request as draft
October 5, 2026 15:05
…wice The status getter polled the store whenever no status was cached yet, so a request arriving while the startup poll was still in flight started a second metadata query of its own. Status requests now wait on the same lock the poll task holds and re-check the cached status after acquiring it, so a poll that is already running satisfies them. The poll schedule is unchanged: the first poll still fires immediately. Observers are notified outside the lock, because a listener that calls back into the manager would otherwise deadlock on a non-reentrant mutex.
jsonbailey
force-pushed
the
jb/fix/bigsegments-double-startup-poll
branch
from
October 5, 2026 22:34
f2ab464 to
012431d
Compare
jsonbailey
marked this pull request as ready for review
October 6, 2026 12:23
keelerm84
reviewed
Oct 6, 2026
keelerm84
approved these changes
Oct 6, 2026
jsonbailey
pushed a commit
that referenced
this pull request
Oct 6, 2026
🤖 I have created a release *beep* *boop* --- ## [8.18.1](8.18.0...8.18.1) (2026-10-06) ### Bug Fixes * Pass connect_timeout to the streaming SSE client ([#458](#458)) ([f4a07af](f4a07af)) * Prevent close from hanging after a persistent store read fails ([91b7c9c](91b7c9c)) * Prevent flags from falling back to defaults when a deleted item has no key ([afb9f3d](afb9f3d)) * Prevent flags from falling back to defaults when Consul holds one item ([8891226](8891226)) * Prevent the store availability poller from outliving the client ([91b7c9c](91b7c9c)) * Publish the data source status before releasing ready waiters ([#431](#431)) ([0e224b9](0e224b9)) * Reuse an in-flight big segment status poll instead of querying twice ([#460](#460)) ([96cca28](96cca28)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > This **Release Please** PR cuts **8.18.1** by bumping `LaunchDarkly::VERSION`, `.release-please-manifest.json`, and the provenance example in `PROVENANCE.md`. > > It adds a **8.18.1** section to `CHANGELOG.md` documenting bug fixes already landed on main: streaming **connect_timeout** wiring, persistent-store **close** and availability-poller lifecycle, flag-evaluation fallbacks with deleted/Consul store edge cases, **data source status** ordering before ready waiters, and deduplicating **big segment** status polls. No SDK implementation files change in this diff—only release bookkeeping. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 46d0611. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
BEGIN_COMMIT_OVERRIDE
fix: Reuse an in-flight big segment status poll instead of always querying twice
END_COMMIT_OVERRIDE
The status getter polled the store whenever no status was cached yet, so a request arriving while the startup poll was still in flight started a second metadata query of its own.
get_context_membershiphad the same inline poll, and now routes throughget_statusso the cache check lives in one place.Status requests now wait on the same
Mutexthe poll task holds and re-check the cached status after acquiring it, so a poll that is already running satisfies them instead of being duplicated. Observers are notified outside the lock — a listener calling back into the manager would otherwise deadlock on Ruby's non-reentrant mutex.The poll schedule is unchanged — the first poll still fires immediately, and the
RepeatingTasktiming arguments are untouched.Matching change in Python: launchdarkly/python-server-sdk#535
Test evidence
Two regression specs added in
spec/impl/big_segments_spec.rb, one per entry point (the status getter andget_context_membership). The store signals when it has entered a metadata query and then stays there, so the request is forced to overlap an in-flight poll rather than relying on timing; each asserts exactly one metadata query. Both fail withexpected: 1, got: 2against the code onmain.Unit suite: 1108 examples, 0 failures. RuboCop: 188 files, no offenses. v2 contract tests: 4703 total, 15 skipped, all passed — including all seven
big segments/status pollingtests.Tracked Internally: SDK-3212
Note
Overview
Fixes duplicate big segment store metadata queries when a status or membership read happens while the startup (or in-flight) poll has not finished yet.
BigSegmentStoreManagernow serializes status fetches with aMutex: callers double-check@last_statusafter acquiring the lock and only run one store query if still empty.get_context_membershipno longer triggers its own inline poll and always goes throughget_status. Store querying is split intoquery_store_status(cache only, under the lock);update_status/ observer notification runs outside the lock to avoid deadlock if a listener re-enters the manager.Regression specs force overlap between the background poll and a status or membership request and assert exactly one
get_metadatacall.Reviewed by Cursor Bugbot for commit 012431d. Bugbot is set up for automated code reviews on this repo. Configure here.