Disable Java serialization by default, #22333 (#27285)

* akka.actor.allow-java-serialization = off
* Moved primitive (Long, Int, String, ByteString) serializers
  from akka-remote to akka-actor since they had no dependency
  and are useful also in local systems, e.g. persistence.
  * e.g. needed for persistence-tck
  * less allow-java-serialization=on in tests
* CborSerializable in Jackson/test module for ease of use
* JavaSerializable for Java serialization in tests, already in akka-testkit,
  but misconfigured
* Made tests pass
  * allow-java-serialization=on in akka-persistence
  * allow-java-serialization=on in classic remoting tests
  * JavaSerializable and CborSerializable in other remoting tests
* Added serialization for
  * Boolean
  * java.util.concurrent.TimeoutException, AskTimeoutException
* support for testing serialization with the inmem journal
* utility to verifySerialization, in SerializationTestKit
* remove AccountExampleWithCommandHandlersInState becuase not possible to serialize State when it's not static
  * Effect() is factory in EventSourcedBehavior  class
* test the account examples
* SharedLeveldbJournal.configToEnableJavaSerializationForTest
* support for exceptions from remote deployed child actors
  * fallback to akka.remote.serialization.ThrowableNotSerializableException
    if exception is not serializable when wrapped in system messages from
    remote deployed child actors and Status.Failure messages
  * it's implemented in `WrappedPayloadSupport.payloadBuilder`
* update reference documentation
* serialize-messages=off in most places, separate ticket for
  improving or removing that feature
* migration guide, including description of rolling update

* fix 2.13 compiler error

* minor review feedback
This commit is contained in:
Patrik Nordwall 2019-07-11 14:04:24 +02:00 committed by GitHub
parent a4f090b622
commit 3efc1c2877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
191 changed files with 4041 additions and 2321 deletions

111
build.sbt
View file

@ -36,41 +36,41 @@ def isScala213: Boolean = System.getProperty("akka.build.scalaVersion", "").star
// When this is updated the set of modules in ActorSystem.allModules should also be updated
lazy val aggregatedProjects: Seq[ProjectReference] = List[ProjectReference](
actor,
actorTests,
actorTestkitTyped,
actorTyped,
actorTypedTests,
benchJmh,
benchJmhTyped,
cluster,
clusterMetrics,
clusterSharding,
clusterShardingTyped,
clusterTools,
clusterTyped,
coordination,
discovery,
distributedData,
docs,
jackson,
multiNodeTestkit,
osgi,
persistence,
persistenceQuery,
persistenceShared,
persistenceTck,
persistenceTyped,
protobuf,
remote,
remoteTests,
slf4j,
stream,
streamTestkit,
streamTests,
streamTestsTck,
streamTyped,
testkit)
actor,
actorTests,
actorTestkitTyped,
actorTyped,
actorTypedTests,
benchJmh,
benchJmhTyped,
cluster,
clusterMetrics,
clusterSharding,
clusterShardingTyped,
clusterTools,
clusterTyped,
coordination,
discovery,
distributedData,
docs,
jackson,
multiNodeTestkit,
osgi,
persistence,
persistenceQuery,
persistenceShared,
persistenceTck,
persistenceTyped,
protobuf,
remote,
remoteTests,
slf4j,
stream,
streamTestkit,
streamTests,
streamTestsTck,
streamTyped,
testkit)
lazy val root = Project(id = "akka", base = file("."))
.aggregate(aggregatedProjects: _*)
@ -118,7 +118,7 @@ lazy val benchJmhTyped = akkaModule("akka-bench-jmh-typed")
.disablePlugins(MimaPlugin, WhiteSourcePlugin, ValidatePullRequest, CopyrightHeaderInPr)
lazy val cluster = akkaModule("akka-cluster")
.dependsOn(remote, remoteTests % "test->test", testkit % "test->test")
.dependsOn(remote, remoteTests % "test->test", testkit % "test->test", jackson % "test->test")
.settings(Dependencies.cluster)
.settings(AutomaticModuleName.settings("akka.cluster"))
.settings(OSGi.cluster)
@ -128,7 +128,10 @@ lazy val cluster = akkaModule("akka-cluster")
.enablePlugins(MultiNodeScalaTest)
lazy val clusterMetrics = akkaModule("akka-cluster-metrics")
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", slf4j % "test->compile")
.dependsOn(
cluster % "compile->compile;test->test;multi-jvm->multi-jvm",
slf4j % "test->compile",
jackson % "test->test")
.settings(OSGi.clusterMetrics)
.settings(Dependencies.clusterMetrics)
.settings(AutomaticModuleName.settings("akka.cluster.metrics"))
@ -147,7 +150,8 @@ lazy val clusterSharding = akkaModule("akka-cluster-sharding")
cluster % "compile->compile;test->test;multi-jvm->multi-jvm",
distributedData,
persistence % "compile->compile",
clusterTools % "compile->compile;test->test")
clusterTools % "compile->compile;test->test",
jackson % "test->test")
.settings(Dependencies.clusterSharding)
.settings(AutomaticModuleName.settings("akka.cluster.sharding"))
.settings(OSGi.clusterSharding)
@ -156,7 +160,7 @@ lazy val clusterSharding = akkaModule("akka-cluster-sharding")
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
lazy val clusterTools = akkaModule("akka-cluster-tools")
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", coordination)
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", coordination, jackson % "test->test")
.settings(Dependencies.clusterTools)
.settings(AutomaticModuleName.settings("akka.cluster.tools"))
.settings(OSGi.clusterTools)
@ -165,7 +169,7 @@ lazy val clusterTools = akkaModule("akka-cluster-tools")
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
lazy val distributedData = akkaModule("akka-distributed-data")
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm")
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", jackson % "test->test")
.settings(Dependencies.distributedData)
.settings(AutomaticModuleName.settings("akka.cluster.ddata"))
.settings(OSGi.distributedData)
@ -303,7 +307,14 @@ lazy val protobuf = akkaModule("akka-protobuf")
.disablePlugins(MimaPlugin)
lazy val remote = akkaModule("akka-remote")
.dependsOn(actor, stream, actorTests % "test->test", testkit % "test->test", streamTestkit % "test", protobuf)
.dependsOn(
actor,
stream,
actorTests % "test->test",
testkit % "test->test",
streamTestkit % "test",
protobuf,
jackson % "test->test")
.settings(Dependencies.remote)
.settings(AutomaticModuleName.settings("akka.remote"))
.settings(OSGi.remote)
@ -311,7 +322,12 @@ lazy val remote = akkaModule("akka-remote")
.settings(parallelExecution in Test := false)
lazy val remoteTests = akkaModule("akka-remote-tests")
.dependsOn(actorTests % "test->test", remote % "test->test", streamTestkit % "test", multiNodeTestkit)
.dependsOn(
actorTests % "test->test",
remote % "test->test",
streamTestkit % "test",
multiNodeTestkit,
jackson % "test->test")
.settings(Dependencies.remoteTests)
.settings(Protobuf.settings)
.settings(parallelExecution in Test := false)
@ -385,7 +401,9 @@ lazy val persistenceTyped = akkaModule("akka-persistence-typed")
persistence % "compile->compile;test->test",
persistenceQuery % "test",
actorTypedTests % "test->test",
actorTestkitTyped % "compile->compile;test->test")
actorTestkitTyped % "compile->compile;test->test",
jackson % "test->test")
.settings(javacOptions += "-parameters") // for Jackson
.settings(Dependencies.persistenceShared)
.settings(AutomaticModuleName.settings("akka.persistence.typed"))
.settings(OSGi.persistenceTyped)
@ -401,7 +419,8 @@ lazy val clusterTyped = akkaModule("akka-cluster-typed")
protobuf,
actorTestkitTyped % "test->test",
actorTypedTests % "test->test",
remoteTests % "test->test")
remoteTests % "test->test",
jackson % "test->test")
.settings(AutomaticModuleName.settings("akka.cluster.typed"))
.configs(MultiJvm)
.enablePlugins(MultiNodeScalaTest)
@ -414,7 +433,9 @@ lazy val clusterShardingTyped = akkaModule("akka-cluster-sharding-typed")
actorTestkitTyped % "test->test",
actorTypedTests % "test->test",
persistenceTyped % "test->test",
remoteTests % "test->test")
remoteTests % "test->test",
jackson % "test->test")
.settings(javacOptions += "-parameters") // for Jackson
.settings(AutomaticModuleName.settings("akka.cluster.sharding.typed"))
// To be able to import ContainerFormats.proto
.settings(Protobuf.importPath := Some(baseDirectory.value / ".." / "akka-remote" / "src" / "main" / "protobuf"))