@@ -593,7 +593,7 @@ StubLauncher::ModelInstanceStubProcess()
593593 stub_message_queue_->Push (initialize_message->ShmHandle ());
594594
595595 bi::managed_external_buffer::handle_t message;
596- RETURN_IF_ERROR ( ReceiveMessageFromStub (message) );
596+ ReceiveMessageFromStub (message);
597597
598598 std::unique_ptr<IPCMessage> initialize_response_message =
599599 IPCMessage::LoadFromSharedMemory (shm_pool_, message);
@@ -724,58 +724,11 @@ StubLauncher::KillStubProcess()
724724#endif
725725}
726726
727- TRITONSERVER_Error*
727+ void
728728StubLauncher::ReceiveMessageFromStub (
729729 bi::managed_external_buffer::handle_t & message)
730730{
731- bool success = false ;
732- while (!success) {
733- uint64_t timeout_miliseconds = 1000 ;
734- {
735- boost::posix_time::ptime timeout =
736- boost::get_system_time () +
737- boost::posix_time::milliseconds (timeout_miliseconds);
738-
739- bi::scoped_lock<bi::interprocess_mutex> lock (*health_mutex_, timeout);
740-
741- // Check if lock has been acquired.
742- if (lock) {
743- ipc_control_->stub_health = false ;
744- } else {
745- // If it failed to obtain the lock, it means that the stub has been
746- // stuck or exited while holding the health mutex lock.
747- return TRITONSERVER_ErrorNew (
748- TRITONSERVER_ERROR_INTERNAL, " Failed to obtain the health mutex." );
749- }
750- }
751-
752- message = parent_message_queue_->Pop (
753- timeout_miliseconds /* duration ms */ , success);
754-
755- bool is_stub_alive = false ;
756- {
757- boost::posix_time::ptime timeout =
758- boost::get_system_time () + boost::posix_time::seconds (1 );
759- bi::scoped_lock<bi::interprocess_mutex> lock (*health_mutex_, timeout);
760- if (lock) {
761- is_stub_alive = ipc_control_->stub_health ;
762- } else {
763- // If It failed to obtain the lock, it means that the stub has been
764- // stuck or exited while holding the health mutex lock.
765- is_stub_alive = false ;
766- }
767- }
768-
769- if (!success && !is_stub_alive) {
770- return TRITONSERVER_ErrorNew (
771- TRITONSERVER_ERROR_INTERNAL,
772- (std::string (" Stub process '" ) + model_instance_name_ +
773- " ' is not healthy." )
774- .c_str ());
775- }
776- }
777-
778- return nullptr ; // success
731+ message = parent_message_queue_->Pop ();
779732}
780733
781734void
0 commit comments