A socket is used simultaneously by multiple greenlets #19

Open
opened 2026-02-15 21:15:19 -05:00 by yindo · 0 comments
Owner

Originally created by @qiansuo1 on GitHub (Mar 20, 2025).

Error log:
Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/tcp/request_reader.py", line 67, in write self.sock.sendall(data.encode()) File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 698, in sendall return _sendall(self, data_memory, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 387, in _sendall timeleft = __send_chunk(socket, chunk, flags, timeleft, end) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 316, in __send_chunk data_sent += socket.send(chunk, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 726, in send self._wait(self._write_event) File "src/gevent/_hub_primitives.py", line 317, in gevent._gevent_c_hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 322, in gevent._gevent_c_hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 297, in gevent._gevent_c_hub_primitives._primitive_wait gevent.exceptions.ConcurrentObjectUseError: This socket is already used by another greenlet: <bound method Waiter.switch of <gevent._gevent_c_waiter.Waiter object at 0x7f698a54bf60>>

Possible cause:

Image Image

There may be a concurrency error in path:dify-plugin-sdks/python/dify_plugin/core/server/io_server.py

Originally created by @qiansuo1 on GitHub (Mar 20, 2025). **Error log:** `Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/dify_plugin/core/server/tcp/request_reader.py", line 67, in write self.sock.sendall(data.encode()) File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 698, in sendall return _sendall(self, data_memory, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 387, in _sendall timeleft = __send_chunk(socket, chunk, flags, timeleft, end) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 316, in __send_chunk data_sent += socket.send(chunk, flags) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/gevent/_socketcommon.py", line 726, in send self._wait(self._write_event) File "src/gevent/_hub_primitives.py", line 317, in gevent._gevent_c_hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 322, in gevent._gevent_c_hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 297, in gevent._gevent_c_hub_primitives._primitive_wait gevent.exceptions.ConcurrentObjectUseError: This socket is already used by another greenlet: <bound method Waiter.switch of <gevent._gevent_c_waiter.Waiter object at 0x7f698a54bf60>>` **Possible cause:** <img width="339" alt="Image" src="https://github.com/user-attachments/assets/c4c92395-6607-45ab-ae87-a001cb7970a2" /> <img width="389" alt="Image" src="https://github.com/user-attachments/assets/12f8be70-26fd-49b0-a865-433d9c0a8962" /> **There may be a concurrency error in path:dify-plugin-sdks/python/dify_plugin/core/server/io_server.py**
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-sdks#19