fix(plugin): prevent hang on PluginInvokeError via iterative unwrap - #38955
Open
bailong-Hakuryu wants to merge 2 commits into
Open
fix(plugin): prevent hang on PluginInvokeError via iterative unwrap#38955bailong-Hakuryu wants to merge 2 commits into
bailong-Hakuryu wants to merge 2 commits into
Conversation
bailong-Hakuryu
marked this pull request as draft
July 14, 2026 14:12
bailong-Hakuryu
marked this pull request as ready for review
July 14, 2026 14:37
|
@bailong-Hakuryu I tried using it and added the code you provided into v1.15.0, but it still seems to hang. Is there anything else I can fix? |
Author
I have updated the PR to address the underlying API hang issue. In base_session.py, queue.Empty handling was previously entering an infinite while True: loop when waiting for MCP server responses if the receiver task remained open, ignoring read timeouts and keeping API worker greenlets blocked. An explicit max_timeout deadline check is now enforced. |
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.
Problem
When an Agent node invokes a plugin tool in a Chatflow, the API service hangs and eventually returns
PluginInvokeError: {"message": "invocation exited without response"}after timeout.Closes #38912
Root Cause
unwrap_plugin_daemon_errorused recursive calls to peel nestedPluginInvokeErrorpayloads. A pathological or cyclic error chain could exhaust the stack and block the event loop.Changes
plugin_daemon_transport.py: Replace recursive unwrap with a bounded iterative loop (cap:MAX_UNWRAP_DEPTH=5, env-configurable). Fixfrom __future__ import annotationsplacement (was afterimport os, causingSyntaxError).'tool_client.py: Addraw_payloadattribute toDifyPluginToolClientErrorand forward it through_raise_tool_daemon_errorso callers retain the original daemon response body for debugging.