Simple chatbot: consider removing cleanup lock from sequential lifecycle
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 66/100
Direção de pesquisa
Comece por examples/clients/simple-chatbot/mcp_simple_chatbot/main.py e percorra os caminhos de chamada de limpeza descritos na issue. Confirme com os maintainers se chamadas concorrentes fora do fluxo demonstrado devem ser suportadas antes de remover o lock. O trabalho estará concluído se o lock for removido mantendo o corpo de limpeza existente e o tratamento de erros, ou se um comentário explicar o caso de uso concorrente pretendido.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
While studying the simple chatbot's context-management lifecycle, I found Server._cleanup_lock confusing because the example does not appear to invoke cleanup concurrently on the same Server.
Source: examples/clients/simple-chatbot/mcp_simple_chatbot/main.py.
The current call paths are sequential:
Server.initialize()awaitsself.cleanup()on initialization failure before re-raising.ChatSession.start()awaitscleanup_servers()in its initialization-error handler and again in itsfinallyblock.cleanup_servers()awaits each server's cleanup in reverse server order.
Repeated cleanup calls therefore do not overlap in the demonstrated flow. A single AsyncExitStack.aclose() already awaits the registered exits sequentially in reverse order, so the lock is not needed to make session teardown precede transport teardown.
Suggested simplification: remove the _cleanup_lock initialization and the async with self._cleanup_lock: wrapper, retaining the existing cleanup body and error handling. Alternatively, a brief comment explaining an intended concurrent-caller use case would clarify why the lock is retained.
This is an example-code clarity/simplification request based on source inspection, not an observed runtime bug or a claim that locks are unnecessary for concurrent cleanup generally. Removing it would remove serialization for callers that use this class concurrently outside the demonstrated flow; that tradeoff needs maintainer judgment. No runtime tests were performed for this report.
Reporting first per the contribution guide. AI assistance: prepared with OpenAI Codex after discussing the example and inspecting its cleanup call paths.
- Linguagem predominante
- Python
- Estrelas
- 24.5k
- Forks
- 4k
- Merge médio
- 1d 4h
- PRs com merge (30d)
- 33
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/python-sdk
-
documentation v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
modelcontextprotocol/python-sdk#3662 ·
Mantenedores costumam responder em até 1 dia
-
Audio(data=b"") raises "Either path or data can be provided", while Image(data=b"") worksTalvez já em andamento @KaiyiQuan assumiu há 1 dia. Abertabug v1 v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
modelcontextprotocol/python-sdk#3656 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
modelcontextprotocol/python-sdk#3654 ·
Mantenedores costumam responder em até 1 dia
-
CORSMiddleware on /register and /token forwards any non-preflight OPTIONS request straight to the body-reading handlerTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Abertabug v1 v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
modelcontextprotocol/python-sdk#3652 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
MCPServer completion handler returning more than 100 values fails on 2026-07-28 sessions and violates the 100-item limit on 2025-11-25 sessionsTalvez já em andamento @musi22 assumiu hoje. Abertabug spec-2026-07-28 v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
modelcontextprotocol/python-sdk#3649 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/python-sdk
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
MystenLabs/MemWal#1163 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
infertopics leaves new nodes without a topic when untopiced neighbours outnumber topiced onesTalvez já em andamento @moneebullah25 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
FinanceFlash/unvibecode#218 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
NVIDIA/earth2studio#1241 ·
Mantenedores costumam responder em até 3 dias