Skip to content

Commit 5fb8768

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

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
/ggml/src/ggml-cuda/mmv.* @JohannesGaessler
99
/ggml/src/ggml-cuda/mmvq.* @JohannesGaessler
1010
/ggml/src/ggml-opt.cpp @JohannesGaessler
11-
/ggml/src/gguf.cpp @JohannesGaessler
11+
/ggml/src/gguf.cpp @JohannesGaessler

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)