Skip to content

Commit 4f925a7

Browse files
authored
Fix bugs in GRPC handler changes (#3823)
1 parent f8f6d7b commit 4f925a7

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

qa/L0_cmdline_trace/test.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
2+
# Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
55
# modification, are permitted provided that the following conditions
@@ -302,16 +302,18 @@ if [ `grep -c "COMPUTE_INPUT_END" summary_ensemble.log` != "7" ]; then
302302
echo -e "Ensemble trace log expects 7 compute"
303303
RET=1
304304
fi
305+
# For GRPC frontend, its handlers will occupy one trace ID on creation
306+
GRPC_ID_OFFSET=3
305307
for trace_str in \
306-
"{\"id\":3,\"model_name\":\"simple\",\"model_version\":1}" \
307-
"{\"id\":4,\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":3}" \
308-
"{\"id\":5,\"model_name\":\"fan_${MODELBASE}\",\"model_version\":1,\"parent_id\":3}" \
309-
"{\"id\":6,\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":5}" \
310-
"{\"id\":7,\"model_name\":\"${MODELBASE}\",\"model_version\":1,\"parent_id\":5}" \
311-
"{\"id\":8,\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":5}" \
312-
"{\"id\":9,\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":5}" \
313-
"{\"id\":10,\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":3}" \
314-
"{\"id\":11,\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":3}" ; do
308+
"{\"id\":$((GRPC_ID_OFFSET+1)),\"model_name\":\"simple\",\"model_version\":1}" \
309+
"{\"id\":$((GRPC_ID_OFFSET+2)),\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+1))}" \
310+
"{\"id\":$((GRPC_ID_OFFSET+3)),\"model_name\":\"fan_${MODELBASE}\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+1))}" \
311+
"{\"id\":$((GRPC_ID_OFFSET+4)),\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+3))}" \
312+
"{\"id\":$((GRPC_ID_OFFSET+5)),\"model_name\":\"${MODELBASE}\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+3))}" \
313+
"{\"id\":$((GRPC_ID_OFFSET+6)),\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+3))}" \
314+
"{\"id\":$((GRPC_ID_OFFSET+7)),\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+3))}" \
315+
"{\"id\":$((GRPC_ID_OFFSET+8)),\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+1))}" \
316+
"{\"id\":$((GRPC_ID_OFFSET+9)),\"model_name\":\"nop_TYPE_INT32_-1\",\"model_version\":1,\"parent_id\":$((GRPC_ID_OFFSET+1))}" ; do
315317
if [ `grep -c ${trace_str} trace_ensemble.log` != "1" ]; then
316318
echo -e "Ensemble trace log expects trace: ${trace_str}"
317319
RET=1

src/servers/grpc_server.cc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions
@@ -4179,17 +4179,18 @@ GRPCServer::Start()
41794179
compression_level_);
41804180
hmodelinfer->Start();
41814181
model_infer_handlers_.emplace_back(hmodelinfer);
4182-
4183-
// Handler for streaming inference requests.
4184-
ModelStreamInferHandler* hmodelstreaminfer = new ModelStreamInferHandler(
4185-
"ModelStreamInferHandler", server_, trace_manager_, shm_manager_,
4186-
&service_, model_stream_infer_cq_.get(),
4187-
infer_allocation_pool_size_ /* max_state_bucket_count */,
4188-
compression_level_);
4189-
hmodelstreaminfer->Start();
4190-
model_stream_infer_handlers_.emplace_back(hmodelstreaminfer);
41914182
}
41924183

4184+
// Handler for streaming inference requests. Keeps one handler for streaming
4185+
// to avoid possible concurrent writes which is not allowed
4186+
ModelStreamInferHandler* hmodelstreaminfer = new ModelStreamInferHandler(
4187+
"ModelStreamInferHandler", server_, trace_manager_, shm_manager_,
4188+
&service_, model_stream_infer_cq_.get(),
4189+
infer_allocation_pool_size_ /* max_state_bucket_count */,
4190+
compression_level_);
4191+
hmodelstreaminfer->Start();
4192+
model_stream_infer_handlers_.emplace_back(hmodelstreaminfer);
4193+
41934194
running_ = true;
41944195
LOG_INFO << "Started GRPCInferenceService at " << server_addr_;
41954196
return nullptr; // success

src/servers/grpc_server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions

0 commit comments

Comments
 (0)