Merge pull request #1573 from drewhk/wip-3475-always-log-error-remoting-drewhk
Error level remoting events are logged by default #3475
This commit is contained in:
commit
23060f1d03
2 changed files with 16 additions and 15 deletions
|
|
@ -431,8 +431,8 @@ private[remote] class EndpointWriter(
|
||||||
throw reason
|
throw reason
|
||||||
}
|
}
|
||||||
|
|
||||||
private def publishAndStay(reason: Throwable): State = {
|
private def logAndStay(reason: Throwable): State = {
|
||||||
publishError(reason)
|
log.error(reason, "Transient association error (association remains live)")
|
||||||
stay()
|
stay()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -511,7 +511,7 @@ private[remote] class EndpointWriter(
|
||||||
remoteMetrics.logPayloadBytes(msg, pduSize)
|
remoteMetrics.logPayloadBytes(msg, pduSize)
|
||||||
|
|
||||||
if (pduSize > transport.maximumPayloadBytes) {
|
if (pduSize > transport.maximumPayloadBytes) {
|
||||||
publishAndStay(new OversizedPayloadException(s"Discarding oversized payload sent to ${recipient}: max allowed size ${transport.maximumPayloadBytes} bytes, actual size of encoded ${msg.getClass} was ${pdu.size} bytes."))
|
logAndStay(new OversizedPayloadException(s"Discarding oversized payload sent to ${recipient}: max allowed size ${transport.maximumPayloadBytes} bytes, actual size of encoded ${msg.getClass} was ${pdu.size} bytes."))
|
||||||
} else if (h.write(pdu)) {
|
} else if (h.write(pdu)) {
|
||||||
stay()
|
stay()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -522,7 +522,7 @@ private[remote] class EndpointWriter(
|
||||||
throw new EndpointException("Internal error: Endpoint is in state Writing, but no association handle is present.")
|
throw new EndpointException("Internal error: Endpoint is in state Writing, but no association handle is present.")
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
case e: NotSerializableException ⇒ publishAndStay(e)
|
case e: NotSerializableException ⇒ logAndStay(e)
|
||||||
case e: EndpointException ⇒ publishAndThrow(e)
|
case e: EndpointException ⇒ publishAndThrow(e)
|
||||||
case NonFatal(e) ⇒ publishAndThrow(new EndpointException("Failed to write message to the transport", e))
|
case NonFatal(e) ⇒ publishAndThrow(new EndpointException("Failed to write message to the transport", e))
|
||||||
}
|
}
|
||||||
|
|
@ -705,8 +705,9 @@ private[remote] class EndpointReader(
|
||||||
}
|
}
|
||||||
|
|
||||||
case InboundPayload(oversized) ⇒
|
case InboundPayload(oversized) ⇒
|
||||||
publishError(new OversizedPayloadException(s"Discarding oversized payload received: " +
|
log.error(new OversizedPayloadException(s"Discarding oversized payload received: " +
|
||||||
s"max allowed size [${transport.maximumPayloadBytes}] bytes, actual size [${oversized.size}] bytes."))
|
s"max allowed size [${transport.maximumPayloadBytes}] bytes, actual size [${oversized.size}] bytes."),
|
||||||
|
"Transient error while reading from association (association remains live)")
|
||||||
|
|
||||||
case StopReading(writer) ⇒
|
case StopReading(writer) ⇒
|
||||||
saveState()
|
saveState()
|
||||||
|
|
|
||||||
|
|
@ -466,9 +466,9 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D
|
||||||
|
|
||||||
"drop unserializable messages" in {
|
"drop unserializable messages" in {
|
||||||
object Unserializable
|
object Unserializable
|
||||||
verifySend(Unserializable) {
|
EventFilter[NotSerializableException](pattern = ".*No configured serialization.*", occurrences = 1).intercept {
|
||||||
expectMsgPF(1.second) {
|
verifySend(Unserializable) {
|
||||||
case AssociationErrorEvent(_: NotSerializableException, _, _, _) ⇒ ()
|
expectNoMsg(1.second) // No AssocitionErrorEvent should be published
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -483,18 +483,18 @@ class RemotingSpec extends AkkaSpec(RemotingSpec.cfg) with ImplicitSender with D
|
||||||
|
|
||||||
"drop sent messages over payload size" in {
|
"drop sent messages over payload size" in {
|
||||||
val oversized = byteStringOfSize(maxPayloadBytes + 1)
|
val oversized = byteStringOfSize(maxPayloadBytes + 1)
|
||||||
verifySend(oversized) {
|
EventFilter[OversizedPayloadException](pattern = ".*Discarding oversized payload sent.*", occurrences = 1).intercept {
|
||||||
expectMsgPF(1.second) {
|
verifySend(oversized) {
|
||||||
case AssociationErrorEvent(e: OversizedPayloadException, _, _, _) if e.getMessage.startsWith("Discarding oversized payload sent") ⇒ ()
|
expectNoMsg(1.second) // No AssocitionErrorEvent should be published
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"drop received messages over payload size" in {
|
"drop received messages over payload size" in {
|
||||||
// Receiver should reply with a message of size maxPayload + 1, which will be dropped and an error logged
|
// Receiver should reply with a message of size maxPayload + 1, which will be dropped and an error logged
|
||||||
verifySend(maxPayloadBytes + 1) {
|
EventFilter[OversizedPayloadException](pattern = ".*Discarding oversized payload received.*", occurrences = 1).intercept {
|
||||||
expectMsgPF(1.second) {
|
verifySend(maxPayloadBytes + 1) {
|
||||||
case AssociationErrorEvent(e: OversizedPayloadException, _, _, _) if e.getMessage.startsWith("Discarding oversized payload received") ⇒ ()
|
expectNoMsg(1.second) // No AssocitionErrorEvent should be published
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue