Skip to content

Commit 5477b11

Browse files
authored
Fix possible "double send" of responses. (#79)
* [DO NOT MERGE] WAR possible segfault * Add comment
1 parent 0220e01 commit 5477b11

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/libtorch.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,23 +1221,25 @@ ModelInstanceState::ProcessRequests(
12211221
// synchronized the stream in the ReadOutputTensors function.
12221222
if (Kind() == TRITONSERVER_INSTANCEGROUPKIND_GPU) {
12231223
#ifdef TRITON_ENABLE_GPU
1224+
// [FIXME] in the case of cudaEventElapsedTime failure, should handle
1225+
// stats reporting more gracefully as the durations are inaccurate
12241226
float compute_input_duration = 0;
12251227
float compute_infer_duration = 0;
1226-
RESPOND_ALL_AND_SET_TRUE_IF_ERROR(
1227-
responses, request_count, all_response_failed,
1228+
LOG_IF_ERROR(
12281229
ConvertCUDAStatusToTritonError(
12291230
cudaEventElapsedTime(
12301231
&compute_input_duration, compute_input_start_event_,
12311232
compute_infer_start_event_),
1232-
TRITONSERVER_ERROR_INTERNAL, "Failed to capture elapsed time"));
1233+
TRITONSERVER_ERROR_INTERNAL, "Failed to capture elapsed time"),
1234+
"Failed to capture elapsed time");
12331235

1234-
RESPOND_ALL_AND_SET_TRUE_IF_ERROR(
1235-
responses, request_count, all_response_failed,
1236+
LOG_IF_ERROR(
12361237
ConvertCUDAStatusToTritonError(
12371238
cudaEventElapsedTime(
12381239
&compute_infer_duration, compute_infer_start_event_,
12391240
compute_output_start_event_),
1240-
TRITONSERVER_ERROR_INTERNAL, "Failed to capture elapsed time"));
1241+
TRITONSERVER_ERROR_INTERNAL, "Failed to capture elapsed time"),
1242+
"Failed to capture elapsed time");
12411243

12421244
compute_start_ns = exec_start_ns + (compute_input_duration * 1e6);
12431245
compute_end_ns = compute_start_ns + (compute_infer_duration * 1e6);

0 commit comments

Comments
 (0)