Skip to content

Commit cbe2c46

Browse files
committed
ggml : Fixed race-condition that leads to crashes when using ggml-rpc
1 parent 2f5a4e1 commit cbe2c46

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
/ggml/src/ggml-cuda/mmvq.* @JohannesGaessler
1010
/ggml/src/ggml-opt.cpp @JohannesGaessler
1111
/ggml/src/gguf.cpp @JohannesGaessler
12+
/ggml/src/ggml-rpc/* @gkpln3
13+
/tools/rpc/rpc-server.cpp @gkpln3

ggml/src/ggml-rpc/ggml-rpc.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ static bool parse_endpoint(const std::string & endpoint, std::string & host, int
386386
// RPC request : | rpc_cmd (1 byte) | request_size (8 bytes) | request_data (request_size bytes) |
387387
// No response
388388
static bool send_rpc_cmd(const std::shared_ptr<socket_t> & sock, enum rpc_cmd cmd, const void * input, size_t input_size) {
389+
static std::mutex send_rpc_cmd_mutex;
390+
std::lock_guard<std::mutex> lock(send_rpc_cmd_mutex);
389391
uint8_t cmd_byte = cmd;
390392
if (!send_data(sock->fd, &cmd_byte, sizeof(cmd_byte))) {
391393
return false;

0 commit comments

Comments
 (0)