Repository navigation
Conversation
Timeout starts one thread for the process on first use and keeps it. Tests that compare thread lists took it for a thread the transport had left behind whenever they were the first to use it. Fixes modelcontextprotocol#739.
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.
Five tests no longer depend on the test order:
test/test_helper.rbstarts the threadTimeoutkeeps for the process before any test runs.Fixes #739
Motivation and Context
The five tests named in the issue compare
Thread.listbefore and after a step.Timeout.timeoutstarts a thread on first use and keeps it, so whichever of them is the first to reach a bounded stream write counts that thread as one the transport started. It failed the Ruby 3.1 job of #736 and the Ruby 3.4 job of #738.#542 made one of these assertions compare the set of threads instead of their count, which holds as long as only the transport can add a thread. The writes bounded by
stream_write_timeoutadd the Timeout thread. Starting it up front restores that assumption for all five, and for tests added later. No library code changes.How Has This Been Tested?
Automated unit / integration tests
Tested manually
Tested in a real application
Run alone on
main, each of the five fails every time. With this change each passes every time.The two seeds that failed on CI (50208 on fix: validate transport timeouts and input round limits #736, 25473 on fix: validate object results before reading client responses #738) fail the same way locally on those branches, and pass on them with this change.
The tests still detect a leak: starting a keepalive despite a
nilinterval, or an extra thread per listen stream or per bounded write, fails each test that covers it.bundle exec rake test(2,815 tests, 10,202 assertions, under each of eight seeds),bundle exec rake rubocop,bundle exec yard --no-outputandbundle exec rake conformance:test(baseline) pass locally on Ruby 4.0.9.Breaking Changes
None.
Types of changes
Checklist