Plugin Crash Due to Buffer Overflow #104

Closed
opened 2026-02-16 00:19:50 -05:00 by yindo · 2 comments
Owner

Originally created by @yanchaao on GitHub (Apr 30, 2025).

Environment

  • plugin: langgenius/bedrock:0.0.13
  • Runtime Version: 0.0.9-local

Problem Description

When using bedrock@0.0.13 to call Claude, if the input contains images that are too large or too many (total size exceeding 2MB), the plugin process is unexpectedly terminated, and the plugin thread is abruptly killed during execution.

  • In the locally deployed version, this always results in a timeout.
  • In the cloud version, it fails with a [PluginDaemonInnerError] message.

Observations

In our usage scenario, increasing the scanner buffer resolves the issue. Specifically, replacing the default buffer with the following helps:
https://github.com/langgenius/dify-plugin-daemon/blob/18a251a82313a00c358b8ee6fcff9054b21eef11/internal/core/plugin_manager/local_runtime/stdio.go#L118-L119

scanner.Buffer(make([]byte, 0, 1024), 16*1024*1024)

Questions

  • Would it be possible to make the buffer size limit configurable?
  • Can the initial buffer size and the maximum limit be exposed as settings?
  • When the buffer exceeds its limit, can the system handle the error gracefully and provide a clear error message?
Originally created by @yanchaao on GitHub (Apr 30, 2025). ### Environment - **plugin**: langgenius/bedrock:0.0.13 - **Runtime Version**: 0.0.9-local ### Problem Description When using `bedrock@0.0.13` to call Claude, if the input contains images that are too large or too many (total size exceeding 2MB), the plugin process is **unexpectedly terminated**, and the plugin thread is **abruptly killed** during execution. - In the **locally deployed version**, this always results in a **timeout**. - In the **cloud version**, it fails with a `[PluginDaemonInnerError]` message. ### Observations In our usage scenario, increasing the scanner buffer resolves the issue. Specifically, replacing the default buffer with the following helps: https://github.com/langgenius/dify-plugin-daemon/blob/18a251a82313a00c358b8ee6fcff9054b21eef11/internal/core/plugin_manager/local_runtime/stdio.go#L118-L119 ```go scanner.Buffer(make([]byte, 0, 1024), 16*1024*1024) ``` ### Questions - Would it be possible to make the buffer size limit configurable? - Can the initial buffer size and the maximum limit be exposed as settings? - When the buffer exceeds its limit, can the system handle the error gracefully and provide a clear error message?
yindo closed this issue 2026-02-16 00:19:50 -05:00
Author
Owner

@Yeuoly commented on GitHub (Apr 30, 2025):

I will make it configurable or you can submit the PR

@Yeuoly commented on GitHub (Apr 30, 2025): I will make it configurable or you can submit the PR
Author
Owner

@yanchaao commented on GitHub (May 8, 2025):

@Yeuoly
Thanks.
The configuration is now ready and needs to be applied.

Change
scanner.Buffer(make([]byte, 1024), 5*1024*1024)
to
scanner.Buffer(make([]byte, 0, s.stdoutBufferSize), s.stdoutMaxBufferSize)

@yanchaao commented on GitHub (May 8, 2025): @Yeuoly Thanks. The configuration is now ready and needs to be applied. Change `scanner.Buffer(make([]byte, 1024), 5*1024*1024)` to `scanner.Buffer(make([]byte, 0, s.stdoutBufferSize), s.stdoutMaxBufferSize)`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#104