Skip to content

Conversation

@4t145
Copy link
Collaborator

@4t145 4t145 commented Jun 18, 2025

Motivation and Context

release related resource when RequestId is removed

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

#268 is for close connection in client side, this pr is for really fix the bug

@github-actions github-actions bot added T-core Core library changes T-transport Transport layer changes labels Jun 18, 2025
@4t145 4t145 marked this pull request as ready for review June 18, 2025 11:47
@4t145 4t145 requested review from Copilot and jokemanfire June 18, 2025 11:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where the streamable HTTP server was not properly releasing resources when a RequestId is removed. The key changes include modifying the logic to close the HTTP channel if its resource list is empty or if the resource is an MCP request, and adding a warning log when the channel is not found.

if let Some(channel) = self.tx_router.get_mut(&http_request_id) {
channel.resources.remove(resource);
if channel.resources.is_empty() {
// It's okey to do so, since we don't handle batch json rcp request anymore
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a spelling mistake in the comment: "okey" should be "okay".

Suggested change
// It's okey to do so, since we don't handle batch json rcp request anymore
// It's okay to do so, since we don't handle batch json rcp request anymore

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
@4t145 4t145 merged commit 8a57765 into modelcontextprotocol:main Jun 18, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants