Occasional errors occur in the dify-sandbox #5232

Closed
opened 2026-02-21 18:09:59 -05:00 by yindo · 5 comments
Owner

Originally created by @yuxizhe on GitHub (Aug 26, 2024).

Originally assigned to: @Yeuoly on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.7.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

After deploying with Docker, the sandbox (docker 0.2.6) occasionally reports errors, with a probability of about 0.4%.

for example:

  • Run failed: Node checkxx stringfiy run failed: 20.11.1\ndbox-afd80081-4a6b-4ab6-82c6-31079c52bedc/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562\n let lib = load(...args);\n ^\n\nError: Failed to load shared library: cannot open shared object file: No such file or directory\n at module.exports.load (/tmp/sandbox-afd80081-4a6b-4ab6-82c6-31079c52bedc/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562:13)\n at Object. (/tmp/sandbox-afd80081-4a6b-4ab6-82c6-31079c52bedc/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/test.js:4:19)\n at Module._compile (node:internal/modules/cjs/loader:1376:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)\n at Module.load (node:internal/modules/cjs/loader:1207:32)\n at Module._load (node:internal/modules/cjs/loader:1023:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)\n at node:internal/main/run_main_module:28:49\n\nNode.js v20.11.1\nerror: exit status 1\n

  • Run failed: Node xx run failed: 20.11.1\ndbox-2427c7e1-d57a-45dc-8519-d987dd8f5006/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562\n let lib = load(...args);\n ^\n\nError: Failed to load shared library: cannot open shared object file: No such file or directory\n at module.exports.load (/tmp/sandbox-2427c7e1-d57a-45dc-8519-d987dd8f5006/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562:13)\n at Object. (/tmp/sandbox-2427c7e1-d57a-45dc-8519-d987dd8f5006/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/test.js:4:19)\n at Module._compile (node:internal/modules/cjs/loader:1376:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)\n at Module.load (node:internal/modules/cjs/loader:1207:32)\n at Module._load (node:internal/modules/cjs/loader:1023:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)\n at node:internal/main/run_main_module:28:49\n\nNode.js v20.11.1\nerror: exit status 1\n

  • Run failed: Node xxx run failed: Failed to invoke tool: Node xxx run failed: Traceback (most recent call last):\n File "/var/sandbox/sandbox-python/tmp/a6b19d1f_17ba_4ed8_8c40_9870b5adacc4.py", line 13, in \n lib = ctypes.CDLL("./var/sandbox/sandbox-python/python.so")\n File "/usr/local/lib/python3.10/ctypes/__init__.py", line 374, in init\n self._handle = _dlopen(self._name, mode)\nOSError: ./var/sandbox/sandbox-python/python.so: cannot open shared object file: No such file or directory\nerror: exit status 255\n

✔️ Expected Behavior

Operates normally.

Actual Behavior

sandbox occasionally reports errors, with a probability of about 0.4%.

Originally created by @yuxizhe on GitHub (Aug 26, 2024). Originally assigned to: @Yeuoly on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.7.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce After deploying with Docker, the sandbox (docker 0.2.6) occasionally reports errors, with a probability of about 0.4%. for example: - Run failed: Node checkxx stringfiy run failed: 20.11.1\ndbox-afd80081-4a6b-4ab6-82c6-31079c52bedc/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562\n let lib = load(...args);\n ^\n\nError: Failed to load shared library: cannot open shared object file: No such file or directory\n at module.exports.load (/tmp/sandbox-afd80081-4a6b-4ab6-82c6-31079c52bedc/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562:13)\n at Object.<anonymous> (/tmp/sandbox-afd80081-4a6b-4ab6-82c6-31079c52bedc/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/test.js:4:19)\n at Module._compile (node:internal/modules/cjs/loader:1376:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)\n at Module.load (node:internal/modules/cjs/loader:1207:32)\n at Module._load (node:internal/modules/cjs/loader:1023:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)\n at node:internal/main/run_main_module:28:49\n\nNode.js v20.11.1\nerror: exit status 1\n - Run failed: Node xx run failed: 20.11.1\ndbox-2427c7e1-d57a-45dc-8519-d987dd8f5006/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562\n let lib = load(...args);\n ^\n\nError: Failed to load shared library: cannot open shared object file: No such file or directory\n at module.exports.load (/tmp/sandbox-2427c7e1-d57a-45dc-8519-d987dd8f5006/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/node_modules/koffi/index.js:562:13)\n at Object.<anonymous> (/tmp/sandbox-2427c7e1-d57a-45dc-8519-d987dd8f5006/var/sandbox/sandbox-nodejs/nodejs-project/node_temp/node_temp/test.js:4:19)\n at Module._compile (node:internal/modules/cjs/loader:1376:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)\n at Module.load (node:internal/modules/cjs/loader:1207:32)\n at Module._load (node:internal/modules/cjs/loader:1023:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)\n at node:internal/main/run_main_module:28:49\n\nNode.js v20.11.1\nerror: exit status 1\n - Run failed: Node xxx run failed: Failed to invoke tool: Node xxx run failed: Traceback (most recent call last):\n File \"/var/sandbox/sandbox-python/tmp/a6b19d1f_17ba_4ed8_8c40_9870b5adacc4.py\", line 13, in <module>\n lib = ctypes.CDLL(\"./var/sandbox/sandbox-python/[python.so](http://python.so/)\")\n File \"/usr/local/lib/python3.10/ctypes/__init__.py\", line 374, in __init__\n self._handle = _dlopen(self._name, mode)\nOSError: ./var/sandbox/sandbox-python/[python.so](http://python.so/): cannot open shared object file: No such file or directory\nerror: exit status 255\n ### ✔️ Expected Behavior Operates normally. ### ❌ Actual Behavior sandbox occasionally reports errors, with a probability of about 0.4%.
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 18:09:59 -05:00
yindo closed this issue 2026-02-21 18:09:59 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 26, 2024):

I found a similar issue where the dify-sandbox occasionally reports errors when deployed with Docker. The root cause is that the Ollama service is not accessible from the Docker container because localhost usually refers to the container itself, not the host machine or other containers. To resolve this, you need to expose the Ollama service to the network using:

http://host.docker.internal:11434

Additionally, ensure your Docker Compose configuration properly sets up the network and environment variables for the dify-sandbox service. Here is an example configuration snippet from the docker-compose.yaml file:

# The DifySandbox
sandbox:
  image: langgenius/dify-sandbox:0.2.6
  restart: always
  environment:
    # The DifySandbox configurations
    API_KEY: ${SANDBOX_API_KEY:-dify-sandbox}
    GIN_MODE: ${SANDBOX_GIN_MODE:-release}
    WORKER_TIMEOUT: ${SANDBOX_WORKER_TIMEOUT:-15}
    ENABLE_NETWORK: ${SANDBOX_ENABLE_NETWORK:-true}
    HTTP_PROXY: ${SANDBOX_HTTP_PROXY:-http://ssrf_proxy:3128}
    HTTPS_PROXY: ${SANDBOX_HTTPS_PROXY:-http://ssrf_proxy:3128}
    SANDBOX_PORT: ${SANDBOX_PORT:-8194}
  volumes:
    - ./volumes/sandbox/dependencies:/dependencies
  networks:
    - ssrf_proxy_network

This setup ensures that the Docker container can correctly access the Ollama service running on the host machine and that the necessary environment variables are set for the dify-sandbox service [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 26, 2024): <!-- Answer --> I found a similar issue where the dify-sandbox occasionally reports errors when deployed with Docker. The root cause is that the Ollama service is not accessible from the Docker container because `localhost` usually refers to the container itself, not the host machine or other containers. To resolve this, you need to expose the Ollama service to the network using: ```bash http://host.docker.internal:11434 ``` Additionally, ensure your Docker Compose configuration properly sets up the network and environment variables for the dify-sandbox service. Here is an example configuration snippet from the `docker-compose.yaml` file: ```yaml # The DifySandbox sandbox: image: langgenius/dify-sandbox:0.2.6 restart: always environment: # The DifySandbox configurations API_KEY: ${SANDBOX_API_KEY:-dify-sandbox} GIN_MODE: ${SANDBOX_GIN_MODE:-release} WORKER_TIMEOUT: ${SANDBOX_WORKER_TIMEOUT:-15} ENABLE_NETWORK: ${SANDBOX_ENABLE_NETWORK:-true} HTTP_PROXY: ${SANDBOX_HTTP_PROXY:-http://ssrf_proxy:3128} HTTPS_PROXY: ${SANDBOX_HTTPS_PROXY:-http://ssrf_proxy:3128} SANDBOX_PORT: ${SANDBOX_PORT:-8194} volumes: - ./volumes/sandbox/dependencies:/dependencies networks: - ssrf_proxy_network ``` This setup ensures that the Docker container can correctly access the Ollama service running on the host machine and that the necessary environment variables are set for the dify-sandbox service <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/model-configuration/ollama.md)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Aug 26, 2024):

This is because it can not locate some required deps .so files.

See FAQ here https://github.com/langgenius/dify-sandbox/blob/main/FAQ.md

Duplicated https://github.com/langgenius/dify/issues/7448

@crazywoola commented on GitHub (Aug 26, 2024): This is because it can not locate some required deps `.so` files. See FAQ here https://github.com/langgenius/dify-sandbox/blob/main/FAQ.md Duplicated https://github.com/langgenius/dify/issues/7448
Author
Owner

@yuxizhe commented on GitHub (Aug 26, 2024):

This is because it can not locate some required deps .so files.

See FAQ here https://github.com/langgenius/dify-sandbox/blob/main/FAQ.md

Duplicated #7448

@crazywoola Thanks a lot. But I am using the Docker version of dify-sandbox, the FAQ covers the locally deployed version. How can I resolve this issue with the Docker version?

@yuxizhe commented on GitHub (Aug 26, 2024): > This is because it can not locate some required deps `.so` files. > > See FAQ here https://github.com/langgenius/dify-sandbox/blob/main/FAQ.md > > Duplicated #7448 @crazywoola Thanks a lot. But I am using the Docker version of dify-sandbox, the FAQ covers the locally deployed version. How can I resolve this issue with the Docker version?
Author
Owner

@Cuihongsen commented on GitHub (Sep 2, 2024):

Run failed: Node xxx run failed: Failed to invoke tool: Node xxx run failed: Traceback (most recent call last):
 File "/var/sandbox/sandbox-python/tmp/a6b19d1f_17ba_4ed8_8c40_9870b5adacc4.py", line 13, in 
 lib = ctypes.CDLL("./var/sandbox/sandbox-python/python.so")
 File "/usr/local/lib/python3.10/ctypes/init.py", line 374, in init
 self._handle = _dlopen(self._name, mode)
OSError: ./var/sandbox/sandbox-python/python.so: cannot open shared object file: No such file or directory
error: exit status 255

I am experiencing the same issue intermittently. The bug seems to originate from the template component and appears to be an inherent issue. Unfortunately, the existing FAQs do not offer a viable solution.

@Cuihongsen commented on GitHub (Sep 2, 2024): ``` Run failed: Node xxx run failed: Failed to invoke tool: Node xxx run failed: Traceback (most recent call last): File "/var/sandbox/sandbox-python/tmp/a6b19d1f_17ba_4ed8_8c40_9870b5adacc4.py", line 13, in lib = ctypes.CDLL("./var/sandbox/sandbox-python/python.so") File "/usr/local/lib/python3.10/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: ./var/sandbox/sandbox-python/python.so: cannot open shared object file: No such file or directory error: exit status 255 ``` I am experiencing the same issue intermittently. The bug seems to originate from the template component and appears to be an inherent issue. Unfortunately, the existing FAQs do not offer a viable solution.
Author
Owner

@Yeuoly commented on GitHub (Sep 6, 2024):

Fixed https://github.com/langgenius/dify-sandbox/pull/63

@Yeuoly commented on GitHub (Sep 6, 2024): Fixed https://github.com/langgenius/dify-sandbox/pull/63
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5232