You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gcgj-dify-1.7.0/api/core
NeatGuyCoding 780748460d fix(api): Fix potential thread leak in MCP `BaseSession` (#22169)
The `BaseSession` class in the `core/mcp/session` package uses `ThreadPoolExecutor` 
to run the receive loop but fails to properly clean up the executor and receiver 
future, leading to potential thread leaks.

This PR addresses this issue by:
- Initializing `_executor` and `_receiver_future` attributes to `None` for proper cleanup checks
- Adding graceful shutdown with a 5-second timeout in the `__exit__` method
- Ensuring the ThreadPoolExecutor is properly shut down to prevent resource leaks

This fix prevents memory leaks and hanging threads in long-running scenarios where 
multiple MCP sessions are created and destroyed.

Signed-off-by: neatguycoding <15627489+NeatGuyCoding@users.noreply.github.com>
Co-authored-by: QuantumGhost <obelisk.reg+git@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
7 months ago
..
agent feat(api/repo): Allow to config repository implementation (#21458) 7 months ago
app feat(api/repo): Allow to config repository implementation (#21458) 7 months ago
base refactor: Remove RepositoryFactory (#19176) 9 months ago
callback_handler Refactor/message cycle manage and knowledge retrieval (#20460) 8 months ago
entities feat: add MCP support (#20716) 7 months ago
errors fix(core/errors): change base class of custom exceptions to ValueError (#11955) 1 year ago
extension refactor: Improve model status handling and structured output (#20586) 8 months ago
external_data_tool Enhance Code Consistency Across Repository with `.editorconfig` (#19023) 9 months ago
file fix: resolve Docker file URL networking issue for plugins (#21334) (#21382) 7 months ago
helper fix: code result included "error" field (#22392) 7 months ago
llm_generator fix: add list contents handling in structured LLM output (#21837) 7 months ago
mcp fix(api): Fix potential thread leak in MCP `BaseSession` (#22169) 7 months ago
memory feat(api/repo): Allow to config repository implementation (#21458) 7 months ago
model_runtime feat: add support for dark icons in provider and tool entities (#22081) 7 months ago
moderation Enhance Code Consistency Across Repository with `.editorconfig` (#19023) 9 months ago
ops improve opik workflow_trace span name to node name (#22356) 7 months ago
plugin fix(plugin): introduce response_type parameter in plugin list API to enable paginated response support (#22251) 7 months ago
prompt feat(api/repo): Allow to config repository implementation (#21458) 7 months ago
rag tablestore vector support more method (#22225) 7 months ago
repositories feat(api/repo): Allow to config repository implementation (#21458) 7 months ago
tools fix: generate deterministic operationId for root endpoints without one (#19888) 7 months ago
variables feat: Persist Variables for Enhanced Debugging Workflow (#20699) 8 months ago
workflow fix workflow node iterator . (#21008) 7 months ago
__init__.py
hosting_configuration.py chore(provider_manager): Update hosted model's name (#14334) 11 months ago
indexing_runner.py fix: document delete image files check file exist (#21991) 7 months ago
model_manager.py unreachable-code for lb model fetch. (#20797) 8 months ago
provider_manager.py refactor: Improve model status handling and structured output (#20586) 8 months ago