Skip to content

Commit

Permalink
Throw exception when request period larger than max tokens rather tha…
Browse files Browse the repository at this point in the history
…n infinite loop (#403)

* Throw exception when request period larger than max tokens rather than infinite loop

* Update periodic_concurrency_worker.cc
  • Loading branch information
matthewkotila authored Sep 29, 2023
1 parent e10c266 commit ef09eba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/c++/perf_analyzer/periodic_concurrency_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ PeriodicConcurrencyWorker::WorkerCallback(uint32_t infer_context_id)
period_completed_callback_();
}
if (ctxs_.at(infer_context_id)->HasReceivedFinalResponse()) {
bool has_not_completed_period{
ctxs_.at(infer_context_id)->GetNumResponsesForCurrentRequest() <
request_period_};
if (has_not_completed_period) {
throw std::runtime_error(
"Request received final response before request period was reached. "
"Request period must be at most the total number of responses "
"received by any request.");
}
request_completed_callback_();
}
}
Expand Down

0 comments on commit ef09eba

Please sign in to comment.