server: sessions of failed scenarios are never closed (close() skipped on the error path)
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 76/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
- Domaine
- testing-qa
Piste de recherche
Start with the connection lifecycle in src/scenarios/server/prompts.ts and resources.ts, then search the server scenarios for the same try/catch pattern. Run npx @modelcontextprotocol/conformance server --url against a server without prompts/list to reproduce the open sessions. Done means failed scenarios close their connections and no longer leave GET streams or sessions open.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
When a server scenario fails, its Streamable HTTP session is never terminated. #79 added the DELETE to the connection's close(), but most scenarios call close() as the last statement of their try block, so it only runs on the success path. When the scenario throws (for example on a -32601 for a method the server does not implement), the catch records the failure and the session, including its GET stream, stays open until the process exits.
For example, on main (7169291), every scenario in src/scenarios/server/prompts.ts and resources.ts follows this shape:
try {
const conn = await connectToServer(serverUrl);
// ... checks that can throw ...
await conn.close(); // skipped when anything above throws
} catch (error) {
checks.push({ /* FAILURE */ });
}
The same pattern is in 0.2.0-alpha.11: of about 50 close() calls in the bundle, 4 are in a finally.
Why it matters
A server that caps concurrent sessions per client (a reasonable defence for an authenticated HTTP server) fills up after a few failing scenarios, and every later scenario gets HTTP 503 at initialize. Their results then describe the harness, not the server. Running conformance server against a gateway with a cap of 4 sessions per client, the 2025-11-25 run gets 13 of these 503s, and scenarios later in the run cannot be scored. Because the open GET stream is also left in place, the server cannot tell those sessions apart from live, idle clients, so it has no safe way to reclaim them.
Expected behavior
Close the connection on every exit path, e.g.:
let conn: Connection | undefined;
try {
conn = await connectToServer(serverUrl);
// ... checks ...
} catch (error) {
checks.push({ /* FAILURE */ });
} finally {
await conn?.close().catch(() => {});
}
To Reproduce
- Run
npx @modelcontextprotocol/conformance server --url <server>against a server that does not implementprompts/list(so the prompts scenarios fail with-32601). - Watch the server: sessions from the failed scenarios receive no DELETE, and their GET streams stay open until the suite exits.
Additional context
Found while running the suite against Fathomgate, an MCP proxy, through its HTTP listener. Happy to send a PR if that helps.
- Langage dominant
- TypeScript
- Étoiles
- 127
- Forks
- 101
- Merge moyen
- 2 j 22 h
- PR mergées (30 j)
- 5
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de modelcontextprotocol/conformance
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
modelcontextprotocol/conformance#531 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
modelcontextprotocol/conformance#530 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
modelcontextprotocol/conformance#519 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
modelcontextprotocol/conformance#315 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
modelcontextprotocol/conformance#312 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de modelcontextprotocol/conformance
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
rohitg00/agentmemory#1428 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
boxlite-ai/boxlite#1729 ·
Les mainteneurs répondent en général sous 1 jour
-
Detect Deno tasks from deno.jsonOuvertedetectors enhancement good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
SM260845/readme-gen#1 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
angular/angularfire#3774 ·
Les mainteneurs répondent en général sous 2 jours