Repository navigation
Test the wake-up of the backoff wait without replacing ConditionVariable.new - #741
Open
koic wants to merge 1 commit into
Conversation
…able.new` ## Motivation and Context `test_input_required_cancellation_wakes_the_backoff_wait`, added in modelcontextprotocol#730, replaced `ConditionVariable.new` for the whole process while it ran. The second call and every later one, from any thread and from `Monitor#new_cond` as well, returned one condition variable whose `wait` ignored its timeout, and the test counted on the client creating exactly one condition variable before the backoff wait. A thread that created one at that moment got the wrong object, so the test could fail, or leave that thread waiting, depending on what else was running. Two tests replace it and leave the class alone. One enters the backoff wait directly, for far longer than the test may take, and cancels once the thread sleeps, so only a wake-up ends it in time. The other cancels as the hook of the backoff wait is registered during a `call_tool`, whatever the timing, and checks that the call raises `CancelledError` with the reason and sends no further request. Follow-up to modelcontextprotocol#730. ## How Has This Been Tested? `test/mcp/client_test.rb`. The first test fails without the signal in the hook of the backoff wait, and the second without the check that precedes each request. ## Breaking Changes None. Only tests change.
This branch has not been deployed
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.
Motivation and Context
test_input_required_cancellation_wakes_the_backoff_wait, added in #730, replacedConditionVariable.newfor the whole process while it ran. The second call and every later one, from any thread and fromMonitor#new_condas well, returned one condition variable whosewaitignored its timeout, and the test counted on the client creating exactly one condition variable before the backoff wait. A thread that created one at that moment got the wrong object, so the test could fail, or leave that thread waiting, depending on what else was running.Two tests replace it and leave the class alone. One enters the backoff wait directly, for far longer than the test may take, and cancels once the thread sleeps, so only a wake-up ends it in time. The other cancels as the hook of the backoff wait is registered during a
call_tool, whatever the timing, and checks that the call raisesCancelledErrorwith the reason and sends no further request.Follow-up to #730.
How Has This Been Tested?
test/mcp/client_test.rb. The first test fails without the signal in the hook of the backoff wait, and the second without the check that precedes each request.Breaking Changes
None. Only tests change.
Types of changes
Checklist