@@ -280,7 +280,9 @@ StubLauncher::Launch()
280280 // Push a dummy message to the message queue so that the stub
281281 // process is notified that it can release the object stored in
282282 // shared memory.
283- stub_message_queue_->Push (DUMMY_MESSAGE);
283+ if (stub_message_queue_) {
284+ stub_message_queue_->Push (DUMMY_MESSAGE);
285+ }
284286
285287 // If the model is not initialized, wait for the stub process to exit.
286288 if (!is_initialized_) {
@@ -303,6 +305,9 @@ StubLauncher::Launch()
303305 // health thread is spawn would make sure would prevent this issue.
304306 bi::managed_external_buffer::handle_t message;
305307 auto err = ReceiveMessageFromStub (message);
308+ if (err != nullptr ) {
309+ KillStubProcess ();
310+ }
306311
307312 if (stub_process_kind_ == " AUTOCOMPLETE_STUB" ) {
308313 if (err != nullptr ) {
@@ -440,7 +445,9 @@ StubLauncher::Launch()
440445 // Push a dummy message to the message queue so that the stub
441446 // process is notified that it can release the object stored in
442447 // shared memory.
443- stub_message_queue_->Push (DUMMY_MESSAGE);
448+ if (stub_message_queue_) {
449+ stub_message_queue_->Push (DUMMY_MESSAGE);
450+ }
444451
445452 // If the model is not initialized, wait for the stub process to exit.
446453 if (!is_initialized_) {
@@ -465,6 +472,9 @@ StubLauncher::Launch()
465472 // health thread is spawn would prevent this issue.
466473 bi::managed_external_buffer::handle_t message;
467474 auto err = ReceiveMessageFromStub (message);
475+ if (err != nullptr ) {
476+ KillStubProcess ();
477+ }
468478
469479 if (stub_process_kind_ == " AUTOCOMPLETE_STUB" ) {
470480 if (err != nullptr ) {
0 commit comments