Merge pull request #1288 from akka/wip-3165-prevent-soe-√
#3165 - Preventing SOE with conflicting serializers when serialize-mess...
This commit is contained in:
commit
be75f706e7
2 changed files with 30 additions and 2 deletions
|
|
@ -9,7 +9,8 @@ import com.typesafe.config.{ Config, ConfigFactory }
|
|||
import akka.actor.{ ActorRef, Actor, ActorSystem }
|
||||
import org.scalatest.WordSpec
|
||||
import org.scalatest.matchers.MustMatchers
|
||||
import akka.event.Logging.{ LogEvent, LoggerInitialized, InitializeLogger }
|
||||
import akka.serialization.SerializationExtension
|
||||
import akka.event.Logging.{ Warning, LogEvent, LoggerInitialized, InitializeLogger }
|
||||
|
||||
object LoggerSpec {
|
||||
|
||||
|
|
@ -37,6 +38,21 @@ object LoggerSpec {
|
|||
}
|
||||
""").withFallback(AkkaSpec.testConf)
|
||||
|
||||
val ticket3165Config = ConfigFactory.parseString("""
|
||||
akka {
|
||||
stdout-loglevel = "WARNING"
|
||||
loglevel = "DEBUG"
|
||||
loggers = ["akka.event.LoggerSpec$TestLogger1"]
|
||||
actor {
|
||||
serialize-messages = on
|
||||
serialization-bindings {
|
||||
"akka.event.Logging$LogEvent" = bytes
|
||||
"java.io.Serializable" = java
|
||||
}
|
||||
}
|
||||
}
|
||||
""").withFallback(AkkaSpec.testConf)
|
||||
|
||||
case class SetTarget(ref: ActorRef, qualifier: Int)
|
||||
|
||||
class TestLogger1 extends TestLogger(1)
|
||||
|
|
@ -127,4 +143,16 @@ class LoggerSpec extends WordSpec with MustMatchers {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
"Ticket 3165 - serialize-messages and dual-entry serialization of LogEvent" must {
|
||||
"not cause StackOverflowError" in {
|
||||
implicit val s = ActorSystem("foo", ticket3165Config)
|
||||
try {
|
||||
SerializationExtension(s).serialize(Warning("foo", classOf[String]))
|
||||
} finally {
|
||||
s.shutdown()
|
||||
s.awaitTermination(5.seconds.dilated)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ object Logging {
|
|||
/**
|
||||
* Base type of LogEvents
|
||||
*/
|
||||
sealed trait LogEvent {
|
||||
sealed trait LogEvent extends NoSerializationVerificationNeeded {
|
||||
/**
|
||||
* The thread that created this log event
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue