Merge pull request #19912 from 412b/fix-19824-unhandled-failure-in-rarp
#19824 Unhandled akka.actor.Status.Failure in RemoteActorRefProvider in state WaitTransportShutdown
This commit is contained in:
commit
b52c498638
3 changed files with 13 additions and 5 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
package akka.remote
|
package akka.remote
|
||||||
|
|
||||||
|
import akka.Done
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.dispatch.sysmsg._
|
import akka.dispatch.sysmsg._
|
||||||
import akka.event.{ Logging, LoggingAdapter, EventStream }
|
import akka.event.{ Logging, LoggingAdapter, EventStream }
|
||||||
|
|
@ -59,10 +60,15 @@ private[akka] object RemoteActorRefProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
when(WaitTransportShutdown) {
|
when(WaitTransportShutdown) {
|
||||||
case Event((), _) ⇒
|
case Event(Done, _) ⇒
|
||||||
log.info("Remoting shut down.")
|
log.info("Remoting shut down.")
|
||||||
systemGuardian ! TerminationHookDone
|
systemGuardian ! TerminationHookDone
|
||||||
stop()
|
stop()
|
||||||
|
|
||||||
|
case Event(Status.Failure(ex), _) ⇒
|
||||||
|
log.error(ex, "Remoting shut down with error")
|
||||||
|
systemGuardian ! TerminationHookDone
|
||||||
|
stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
package akka.remote
|
package akka.remote
|
||||||
|
|
||||||
import akka.AkkaException
|
import akka.AkkaException
|
||||||
|
import akka.Done
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.event.{ LoggingAdapter }
|
import akka.event.{ LoggingAdapter }
|
||||||
import scala.collection.immutable
|
import scala.collection.immutable
|
||||||
|
|
@ -39,7 +40,7 @@ private[akka] abstract class RemoteTransport(val system: ExtendedActorSystem, va
|
||||||
/**
|
/**
|
||||||
* Shuts down the remoting
|
* Shuts down the remoting
|
||||||
*/
|
*/
|
||||||
def shutdown(): Future[Unit]
|
def shutdown(): Future[Done]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address to be used in RootActorPath of refs generated for this transport.
|
* Address to be used in RootActorPath of refs generated for this transport.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package akka.remote
|
package akka.remote
|
||||||
|
|
||||||
|
import akka.Done
|
||||||
import akka.actor.SupervisorStrategy._
|
import akka.actor.SupervisorStrategy._
|
||||||
import akka.actor._
|
import akka.actor._
|
||||||
import akka.event.{ Logging, LoggingAdapter }
|
import akka.event.{ Logging, LoggingAdapter }
|
||||||
|
|
@ -135,7 +136,7 @@ private[remote] class Remoting(_system: ExtendedActorSystem, _provider: RemoteAc
|
||||||
private def notifyError(msg: String, cause: Throwable): Unit =
|
private def notifyError(msg: String, cause: Throwable): Unit =
|
||||||
eventPublisher.notifyListeners(RemotingErrorEvent(new RemoteTransportException(msg, cause)))
|
eventPublisher.notifyListeners(RemotingErrorEvent(new RemoteTransportException(msg, cause)))
|
||||||
|
|
||||||
override def shutdown(): Future[Unit] = {
|
override def shutdown(): Future[Done] = {
|
||||||
endpointManager match {
|
endpointManager match {
|
||||||
case Some(manager) ⇒
|
case Some(manager) ⇒
|
||||||
implicit val timeout = ShutdownTimeout
|
implicit val timeout = ShutdownTimeout
|
||||||
|
|
@ -156,10 +157,10 @@ private[remote] class Remoting(_system: ExtendedActorSystem, _provider: RemoteAc
|
||||||
case Failure(e) ⇒
|
case Failure(e) ⇒
|
||||||
notifyError("Failure during shutdown of remoting.", e)
|
notifyError("Failure during shutdown of remoting.", e)
|
||||||
finalize()
|
finalize()
|
||||||
} map { _ ⇒ () } // RARP needs only type Unit, not a boolean
|
} map { _ ⇒ Done } // RARP needs only akka.Done, not a boolean
|
||||||
case None ⇒
|
case None ⇒
|
||||||
log.warning("Remoting is not running. Ignoring shutdown attempt.")
|
log.warning("Remoting is not running. Ignoring shutdown attempt.")
|
||||||
Future successful (())
|
Future successful Done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue