This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch fix-ain-cannot-stop
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/fix-ain-cannot-stop by this
push:
new 9f842a16b42 Update service.py
9f842a16b42 is described below
commit 9f842a16b421380de75bab29bac840242c13b29b
Author: Yongzao <[email protected]>
AuthorDate: Tue Jan 20 13:45:31 2026 +0800
Update service.py
---
iotdb-core/ainode/iotdb/ainode/core/rpc/service.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/iotdb-core/ainode/iotdb/ainode/core/rpc/service.py
b/iotdb-core/ainode/iotdb/ainode/core/rpc/service.py
index 472b91c204a..3f47b7e976e 100644
--- a/iotdb-core/ainode/iotdb/ainode/core/rpc/service.py
+++ b/iotdb-core/ainode/iotdb/ainode/core/rpc/service.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
#
+import socket
import threading
from thrift.protocol import TBinaryProtocol, TCompactProtocol
@@ -40,20 +41,27 @@ class AINodeThreadPoolServer(TServer.TThreadPoolServer):
"""Start a fixed number of worker threads and put client into a
queue"""
for i in range(self.threads):
try:
- t = threading.Thread(target=self.serveThread)
- t.daemon = self.daemon
+ t = threading.Thread(target=self.serveThread,
daemon=self.daemon)
t.start()
except Exception as x:
logger.error(x)
# Pump the socket for clients
self.serverTransport.listen()
+ handle = getattr(self.serverTransport, "handle", None)
+ if handle is not None and hasattr(handle, "settimeout"):
+ # set handle timeout to 100ms
+ handle.settimeout(0.1)
while not self._stop_event.is_set():
try:
client = self.serverTransport.accept()
if not client:
continue
self.clients.put(client)
+ except socket.timeout:
+ continue
except Exception as x:
+ if self._stop_event.is_set():
+ break
logger.error(x)
logger.info(
"The RPC service thread pool of IoTDB-AINode has successfully
stopped."