Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lightllm/server/audioserver/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import asyncio
import uvloop
import rpyc
import socket

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

To apply the rpyc socket optimizations consistently, it's better to use the rpyc_fix_utils module introduced in this PR. It monkey-patches rpyc to handle socket options centrally. This avoids manual and fragile manipulation of internal attributes. You should import it here instead of socket, and then the explicit setsockopt call can be removed.

Suggested change
import socket
import lightllm.utils.rpyc_fix_utils as _

import inspect
import setproctitle
from typing import List
Expand Down Expand Up @@ -39,6 +40,7 @@ def __init__(
self.zmq_recv_socket = context.socket(zmq.PULL)
self.zmq_recv_socket.bind(f"{args.zmq_mode}127.0.0.1:{args.audio_port}")
self.cache_client = rpyc.connect("localhost", args.cache_port, config={"allow_pickle": True})
self.cache_client._channel.stream.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This line should be removed. Accessing internal rpyc attributes like _channel is fragile and can break in future versions. After importing rpyc_fix_utils at the top of the file, this TCP_NODELAY socket option will be set automatically on the rpyc connection.

self.cache_port = args.cache_port
self.waiting_reqs: List[GroupReqIndexes] = []
self.model_weightdir = args.model_dir
Expand Down
1 change: 1 addition & 0 deletions lightllm/server/embed_cache/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def start_cache_manager(args: StartArgs, pipe_writer):
manager = InMemoryCache(args)
service = CacheServer(manager)
from rpyc.utils.server import ThreadedServer
import lightllm.utils.rpyc_fix_utils as _

t = ThreadedServer(service, port=args.cache_port, protocol_config={"allow_pickle": True})
pipe_writer.send("init ok")
Expand Down
2 changes: 1 addition & 1 deletion lightllm/server/multimodal_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def preload(self, request: Request):
return

except Exception as e:
raise ValueError(f"Failed to read image type={self._type}, data[:100]={self._data[:100]}: {e}!")
raise ValueError(f"Failed to read audio type={self._type}, data[:100]={self._data[:100]}: {e}!")

def read(self):
assert self._preload_data is not None
Expand Down