Repository navigation
Conversation
…vent lost wakeup The Windows Event Log service signals pull-mode subscriptions via SetEvent on a manual-reset event each time a new matching event is recorded. Because SetEvent on an already-signaled handle is a no-op, resetting the handle AFTER draining EvtNext creates a race: a signal arriving between the last EvtNext and ResetEvent is silently lost and the source freezes until the next event arrives. Reset before the drain so signals raised mid-drain are preserved; re-SetEvent on early break (budget exhausted / bookmark failure) so channels are not starved. Fixes vectordotdev#25194
…rden regression test Address review feedback on vectordotdev#25195: - Re-SetEvent on the EvtNext error-return path. Without this, a transient EvtNext failure leaves the pre-drain-reset signal cleared with events possibly still un-drained — the same class of lost-wakeup the PR fixes for the success path. - Replace the primitive-level Barrier test with an integration-style test that drives real pull_events against a real EvtSubscribe handle. A new cfg(test) DRAIN_STEP_HOOK fires SetEvent on the subscription's signal handle inside the drain loop, simulating the OS signaling a fresh event mid-drain. After pull_events returns, wait_for_events_blocking must return EventsAvailable; under the old post-drain ResetEvent order it would time out. This test would now actually catch a reversion.
Two small hardenings to make the test deterministically catch a reversion of the pull_events signal-reset ordering: - Use pull_events(usize::MAX) instead of pull_events(100) so the drain exits via ERROR_NO_MORE_ITEMS (channel_drained = true). On hosts with >100 Application events the old budget would exit via budget exhaustion, skipping the post-drain ResetEvent in the pre-fix code and letting the test false-pass against the buggy ordering. - Wrap hook cleanup in a drop-guard so a panic mid-test doesn't leak the global DRAIN_STEP_HOOK into other tests sharing the process.
…ription Addresses Codex review feedback on vectordotdev#25195. DRAIN_STEP_HOOK is a process-global and cargo runs tests in parallel, so a concurrent test's pull_events could trigger this test's one-shot hook first, flip `fired`, and SetEvent on the wrong signal handle — intermittently timing out test_pull_events_preserves_setevent_during_drain and perturbing the sibling pull_events tests. Capture the subscription's own signal handle up front and make the hook no-op when invoked for any other handle. Add a cfg(test)-only first_channel_signal_raw accessor for the test to read it.
tot19
force-pushed
the
tot19/windows-event-log-ci-test
branch
from
April 15, 2026 08:04
c1f8c06 to
c00bf90
Compare
Fixes check-fmt CI failure on vectordotdev#25195.
Swap windows-2025-8core (vectordotdev private runner, unavailable on forks) for windows-latest so the Windows integration workflow can run against this PR's branch on the tot19/vector fork. Matches the runner choice used successfully on the windows-latest-runner branch while bringing up this source originally.
Matches the serialization that was applied on the original windows-latest-runner branch. Even with per-test provider names isolating eventcreate + XPath filters, the Windows Event Log service has shared per-channel signal handles and bookmarks that can cause cross-test interference when nextest parallelizes across cores. Running with --test-threads=1 is what actually went green in the prior runner bring-up, so mirror it here to keep the integration workflow deterministic on windows-latest.
tot19
force-pushed
the
tot19/windows-event-log-ci-test
branch
from
April 15, 2026 08:09
c00bf90 to
e27da1a
Compare
So Windows unit tests (including the windows_event_log source's #[cfg(windows)] regression test for vectordotdev#25194) actually execute on PRs and can be manually triggered on the fork. Scoped via paths filter to files that could change Windows-only code.
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.
Summary
Fixes a freeze in the
windows_event_logsource that manifested after ~3 minutes of idle time, typically coinciding with h2 GoAway/backpressure events.Two complementary fixes:
1. Pre-drain signal reset (
subscription.rs)The subscription's manual-reset wait handle was previously reset after draining events via
EvtNext. AnySetEventcall from the Windows Event Log service that arrived between the lastEvtNextand theResetEventwas silently lost — the source then hung until the next OS event arrived.Fix: reset the handle before entering the drain loop. Notifications raised mid-drain are preserved because
SetEventon an already-signaled handle is a no-op. Re-arming (SetEvent) is done on early exits (budget exhausted, bookmark failure, or transientEvtNexterror) so those paths still revisit channels on the next call without waiting for a fresh OS notification.2. Speculative pull on timeout (
mod.rs)Even with the pre-drain fix, if the signal is lost through any other mechanism (e.g. a GoAway/backpressure interaction that interrupts the drain loop in a way that doesn't hit the
SetEventre-arm paths), the source would still freeze until the next event arrived.Fix: on each
WaitResult::Timeout, callpull_eventsspeculatively.EvtNextreturnsERROR_NO_MORE_ITEMSimmediately on an empty channel (near-zero cost), so this is safe every cycle. If events are recovered, awarn!is emitted. This guarantees self-healing within one timeout period regardless of root cause — belt and suspenders.Regression test
test_pull_events_preserves_setevent_during_drainpins the pre-drain reset invariant by driving the realEvtSubscribehandle with aDRAIN_STEP_HOOKthat firesSetEventmid-drain (simulating the race window). Afterpull_eventsreturns,wait_for_events_blockingmust returnEventsAvailable, notTimeout. Under the old post-drain reset order, it would time out — which is exactly the freeze reported.Vector configuration
N/A — internal fix, no configuration changes.
How did you test this PR?
test_pull_events_preserves_setevent_during_drain(Windows CI)EvtNextreturningERROR_NO_MORE_ITEMSimmediately on an empty channelChange Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.(Changelog fragment is included at
changelog.d/25194_windows_event_log_lost_wakeup.fix.md.)References
Notes
@vectordotdev/vectorto reach out to us regarding this PR.