@@ -302,9 +302,12 @@ StubLauncher::Launch()
302302  //  that the stub process is unhealthy and return early. Waiting until the
303303  //  health thread is spawn would make sure would prevent this issue.
304304  bi::managed_external_buffer::handle_t  message;
305-   RETURN_IF_ERROR ( ReceiveMessageFromStub (message) );
305+   auto  err =  ReceiveMessageFromStub (message);
306306
307307  if  (stub_process_kind_ == " AUTOCOMPLETE_STUB"  ) {
308+     if  (err != nullptr ) {
309+       throw  BackendModelException (err);
310+     }
308311    try  {
309312      AutocompleteStubProcess ();
310313    }
@@ -315,6 +318,7 @@ StubLauncher::Launch()
315318          TRITONSERVER_ErrorNew (TRITONSERVER_ERROR_INTERNAL, ex.what ()));
316319    }
317320  } else  if  (stub_process_kind_ == " MODEL_INSTANCE_STUB"  ) {
321+     RETURN_IF_ERROR (err);
318322    RETURN_IF_ERROR (ModelInstanceStubProcess ());
319323  } else  {
320324    return  TRITONSERVER_ErrorNew (
@@ -460,9 +464,12 @@ StubLauncher::Launch()
460464    //  that the stub process is unhealthy and return early. Waiting until the
461465    //  health thread is spawn would prevent this issue.
462466    bi::managed_external_buffer::handle_t  message;
463-     RETURN_IF_ERROR ( ReceiveMessageFromStub (message) );
467+     auto  err =  ReceiveMessageFromStub (message);
464468
465469    if  (stub_process_kind_ == " AUTOCOMPLETE_STUB"  ) {
470+       if  (err != nullptr ) {
471+         throw  BackendModelException (err);
472+       }
466473      try  {
467474        AutocompleteStubProcess ();
468475      }
@@ -473,6 +480,7 @@ StubLauncher::Launch()
473480            TRITONSERVER_ErrorNew (TRITONSERVER_ERROR_INTERNAL, ex.what ()));
474481      }
475482    } else  if  (stub_process_kind_ == " MODEL_INSTANCE_STUB"  ) {
483+       RETURN_IF_ERROR (err);
476484      RETURN_IF_ERROR (ModelInstanceStubProcess ());
477485    } else  {
478486      return  TRITONSERVER_ErrorNew (
0 commit comments