@@ -723,17 +723,10 @@ Stub::ProcessRequests(RequestBatch* request_batch_shm_ptr)
723
723
// the response batch. It is necessary to handle cases where the response
724
724
// sender should have already cleaned up, ensuring the backend does not
725
725
// delete the response factory again during error handling.
726
- if (err_message.find (" Response sender has been closed" ) !=
727
- std::string::npos) {
728
- response_batch_shm_ptr->is_response_factory_deleted = true ;
729
- } else if (
730
- err_message.find (" is using the decoupled mode and the execute function "
731
- " must return None" ) != std::string::npos) {
732
- for (py::handle py_request : py_request_list) {
733
- InferRequest* request = py_request.cast <InferRequest*>();
734
- if (request->GetResponseSender ()->IsClosed ()) {
735
- response_batch_shm_ptr->is_response_factory_deleted = true ;
736
- }
726
+ for (py::handle py_request : py_request_list) {
727
+ InferRequest* request = py_request.cast <InferRequest*>();
728
+ if (request->GetResponseSender ()->IsClosed ()) {
729
+ response_batch_shm_ptr->is_response_factory_deleted = true ;
737
730
}
738
731
}
739
732
@@ -846,16 +839,8 @@ Stub::ProcessReturnedResponses(
846
839
}
847
840
catch (const PythonBackendException& pb_exception) {
848
841
// Handle the exception here to catch the error when there's a response
849
- // returned from `execute()`, and the below error message is thrown.
850
- // In default (non-decoupled) mode, the response factory should already
851
- // have been cleaned up when the previous response was sent by the
852
- // response sender. However, if the model attempts to return another
853
- // response from the `execute()` function, notify the backend NOT to
854
- // delete the response factory again during error handling.
855
- std::string err_message = pb_exception.what ();
856
- if (err_message.find (
857
- " Non-decoupled model cannot send more than one response" ) !=
858
- std::string::npos) {
842
+ // returned from `execute()`.
843
+ if (request->GetResponseSender ()->IsClosed ()) {
859
844
response_batch = std::move (shm_pool_->Construct <char >(
860
845
sizeof (ResponseBatch) + sizeof (IPCMessageShm)));
861
846
ResponseBatch* response_batch_shm_ptr =
0 commit comments