Reentrant provider events reach client callbacks out of order
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with dispatch_provider_event in lib/open_feature/sdk/configuration.rb, where global handlers run before client handlers and can re-dispatch reentrantly. Run the reproduction from the issue both ways (default and ready_stale) to confirm the wrong order. Done means both commands print the expected order, and deferred events keep their emission order and are dropped when a provider is shut down or replaced. The author says a local fix is already in preparation, so check with them before starting.
索引モデルが issue の本文から書いたものです。
説明
Problem
Applications tracking provider availability through client event handlers can receive PROVIDER_READY followed by PROVIDER_ERROR after a provider has recovered. A similar sequence delivers PROVIDER_STALE before the preceding PROVIDER_READY.
This happens when a global event handler synchronously emits another provider event. The nested event reaches client handlers before the original event does. It reproduces with openfeature-sdk 0.5.1, 0.6.5, and current main at e602d1559af71324dcc11cc45462ba47075f32f9, using Ruby 4.0.1.
Related: #300 tracks provider lifecycle event ownership, and #137 tracks broader concurrency. This reproduction uses an already initialized provider and manually emitted events, so it also occurs independently of synthetic initialization events.
Reproduction
Save this as repro.rb and run it in an environment with openfeature-sdk installed. No Datadog dependency, network requests, or background threads are needed.
require "open_feature/sdk"
class EmittingProvider < OpenFeature::SDK::Provider::InMemoryProvider
include OpenFeature::SDK::Provider::EventEmitter
end
configuration = OpenFeature::SDK.configuration
provider = EmittingProvider.new
configuration.set_provider_and_wait(provider)
provider.emit_event(OpenFeature::SDK::ProviderEvent::PROVIDER_STALE)
client = OpenFeature::SDK::Client.new(provider: provider)
events = []
first, following = (ARGV.first == "ready_stale") ? [:READY, :STALE] : [:ERROR, :READY]
first_event = OpenFeature::SDK::ProviderEvent.const_get("PROVIDER_#{first}")
following_event = OpenFeature::SDK::ProviderEvent.const_get("PROVIDER_#{following}")
configuration.add_handler(first_event, ->(_) { provider.emit_event(following_event) })
client.add_handler(first_event, ->(_) { events << first })
client.add_handler(following_event, ->(_) { events << following })
events.clear # Ignore immediate callbacks during handler registration.
provider.emit_event(first_event)
puts "Expected: #{[first, following].inspect}; actual: #{events.inspect}"
| Command | Expected callbacks | Actual callbacks |
|---|---|---|
ruby repro.rb |
[:ERROR, :READY] |
[:READY, :ERROR] |
ruby repro.rb ready_stale |
[:READY, :STALE] |
[:STALE, :READY] |
Proposed direction
In Configuration#dispatch_provider_event, state is updated before global handlers and then client handlers run. A global handler can recursively dispatch another event before the original client callbacks finish.
Finish delivery of the current event to global and client handlers before dispatching events emitted reentrantly on the same thread. Deferred events should preserve their emission order and payload, and must be invalidated when the associated provider registration ends through shutdown or replacement. This need not impose total ordering across independent threads.
A local fix and SDK-native regression tests are in preparation. The downstream report that led to this reproduction is DataDog/dd-trace-rb#6418.
- 主要言語
- Ruby
- スター
- 43
- フォーク
- 18
- 平均マージ
- 8時間 50分
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
open-feature/ruby-sdk のほかの issue
-
OpenFeature specification v0.9.0
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
open-feature/ruby-sdk#300 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
open-feature/ruby-sdk#297 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
open-feature/ruby-sdk#137 ·
メンテナーはふだん 1 日以内に返信
-
Dependency Dashboardオープン
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
open-feature/ruby-sdk#4 ·
メンテナーはふだん 1 日以内に返信
open-feature/ruby-sdk の issue をすべて見る
似ている issue
-
🐛 bug 🧑💼 conseillers
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
betagouv/conseillers-entreprises#4768 ·
メンテナーはふだん 1 日以内に返信
-
`github-events` aborts the repository scan when a closed pull's API payload has a null `head`対応中かも @renyamamoto2026-cmyk が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zerocracy/judges-action#2823 ·
メンテナーはふだん 1 日以内に返信
-
`spoom srb bump DIRECTORY` bumps files outside DIRECTORY対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/aws-sdk-ruby#3460 ·
メンテナーはふだん 1 日以内に返信