-
Notifications
You must be signed in to change notification settings - Fork 97
Wip upgrade to 2.6.x √ #293
The head ref may contain hidden characters: "wip-upgrade-to-2.6.x-\u221A"
Conversation
dfa7b33
to
30c24e3
Compare
assemblyMergeStrategy in assembly := { | ||
/*ADD CUSTOMIZATIONS HERE*/ | ||
case PathList("META-INF", "io.netty.versions.properties") => MergeStrategy.last | ||
case PathList(ps @ _*) if ps.last endsWith ".proto" => MergeStrategy.last |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we create "fat jars" it doesn't make sense to add the protos, as we don't expect anything to load them from the jar.
@@ -376,32 +413,30 @@ lazy val `proxy-core` = (project in file("proxy/core")) | |||
"io.grpc" % "grpc-netty-shaded" % GrpcJavaVersion, | |||
// Since we exclude Aeron, we also exclude its transitive Agrona dependency, so we need to manually add it HERE | |||
"org.agrona" % "agrona" % "0.9.29", | |||
"com.typesafe.akka" %% "akka-remote" % AkkaVersion excludeAll (excludeTheseDependencies: _*), | |||
akkaDependency("akka-remote"), | |||
"com.typesafe.akka" %% "akka-protobuf-v390" % (AkkaVersion + "-proto390") excludeAll (excludeTheseDependencies: _*), // FIXME since akka-protobuf-v3 uses a shaded protobuf-java 3.10.0 which is not supported in native-image yet… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patriknw special-cut this for us, as Protobuf-Java 3.10.0 uses VarHandles which are not fully working with GraalVM native-image 20.0.0 (and 20.1.0-dev).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the usage of method handles was removed again in protobuf-java 3.11. So we may be able to instead upgrade akka-protobuf-v3 to 3.11?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also discussed in protocolbuffers/protobuf#6497
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try updating akka-protobuf-v3 to 3.11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvlugter This cannot be fixed until Akka 2.6.6
@@ -1,66 +0,0 @@ | |||
package io.cloudstate.graaltools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature didn't work as intended, as it could not see what it needed to see, so I removed it until we can find a suitable replacement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is that not all subtypes are reachable. But for those that are, it's a convenience to register their constructor (which otherwise mightn't be reached by any bytecode). (Side note: makes me wonder if registering the classes makes any sense, if the type is already reachable).
And for all the subtypes that are also used but not reached, I would just hard-code them here and reuse the same logic, instead of hard-code them verbosely in the config file.
val AkkaHttpVersion = "10.1.11" | ||
val AkkaManagementVersion = "1.0.5" | ||
val AkkaPersistenceCassandraVersion = "0.102" | ||
val PrometheusClientVersion = "0.6.0" | ||
val ScalaTestVersion = "3.0.5" | ||
val ProtobufVersion = "3.9.0" | ||
val ProtobufVersion = "3.9.0" // We use this version because it is the latest which works with native-image 20.0.0 | ||
val GraalVersion = "20.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20.0.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hepin1989 2.1.0 will be released in 2 weeks, so holding off making modifications to GraalVM until then.
6bed467
to
05b310d
Compare
@@ -0,0 +1,6 @@ | |||
[ | |||
{ | |||
"name": "com.typesafe.sslconfig.ssl.NoopHostnameVerifier" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on what it's being used for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patriknw Do you have any suggestion what what hostname verifier we should be using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sslconfig. That isn't used for Akka remoting. It was deprecated in Akka 2.6. I would be surprised if it's used by Akka gRPC. @raboof do you know? Or is it still used in Akka HTTP?
05b310d
to
ac21d63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know anything about the graal setup, but changes look reasonable to me.
sharding { | ||
rebalance-interval = 5s | ||
passivate-idle-entity-after = off // FIXME put in a good value here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And remove the built-in passivation using receive timeout. Looks like cloudstate.proxy.passivation-timeout
is currently 30s. Could substitute that setting here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvlugter I suspect that we need to remove the receive timeout thing at the same time to not have competing timers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, remove the receive timeout at the same time. Although, I can imagine that passivation timeouts is something that will want to be defined per entity type on the user side? Maybe this needs its own issue to be enhanced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvlugter Makes sense to make the change separately from this PR. (Hence the FIXME)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Would be good to capture in an issue then, rather than just a FIXME.
@@ -11,9 +11,9 @@ import java.util.concurrent.ConcurrentHashMap | |||
final class ProtobufGeneratedMessageRegisterFeature extends Feature { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be modified. With the old version of protobuf that Akka used, the equals
, hashCode
and toString
implementations used reflection, which is why every method needed a reflection configuration. But the new protobuf version they're on, when configured to be optimized for speed (rather than bytecode size), generates equals
, hashCode
and toString
methods that don't use reflection. Furthermore, all of the akka.protobufv3.internal.*
subtypes, Akka never loads them or interacts with them using reflection, rather, Akka has hand coded serializers that convert the Akka types to these types statically, and uses short manifest names, rather than classnames, with static mappings of these names to the protobuf types, when deserializisng. So, we should be able to just remove akka.protobufv3.*
from here, no reflection configuration should be needed for it.
We still do need some config for the Cloudstate messages that we expect to be serialized by the Akka protobuf serializer, but I think there might be some problems with the code below, the Akka protobuf serializer uses parseFrom
and toByteArray
reflectively, but I don't see those being registered. Also, not sure how much of an overhead this is going to be to have configuration for classes that don't need it, we have a lot of protobuf classes that don't get loaded reflectively, only those sent over Akka remoting as top level messages need reflection configuration, which is only a handful of messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jroper I'll try removing protobufv3 and report back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jroper You were right! Removing the protobufv3 worked. I'll see if I can remove the need for the methods again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jroper It would be interesting to simplyfy this AutomaticFeature—but the challenge is the ridiculously long turnaround time to try even the smallest changes. Feel free (encouraged!) to find optimizations here! 👍
ac21d63
to
afa32ef
Compare
afa32ef
to
0467e03
Compare
@pvlugter This is ready to merge on my end. |
My preference would be to keep this open until the WIP and FIXMEs are addressed, so they're not forgotten or become comfortable hanging out in the codebase. |
Co-authored-by: Viktor Klang (√) <[email protected]>
@@ -16,6 +16,7 @@ inThisBuild( | |||
organizationHomepage := Some(url("https://lightbend.com")), | |||
startYear := Some(2019), | |||
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")), | |||
resolvers += "Akka Snapshots" at "https://repo.akka.io/snapshots/", // FIXME for akka-protobuf-v390 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pvlugter This cannot be fixed until Akka 2.6.6
@@ -3,6 +3,9 @@ | |||
akka { | |||
actor { | |||
provider = cluster | |||
allow-java-serialization = off | |||
warn-about-java-serializer-usage = off | |||
internal-dispatcher = akka.actor.default-dispatcher // FIXME consider removing this line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a valid choice for Cloudstate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @patriknw!
@@ -39,6 +42,8 @@ akka { | |||
artery { | |||
enabled = on | |||
transport = tcp | |||
// FIXME do we need to set canonical.hostname? | |||
// FIXME do we need to set advanced.tcp.connection-timeout? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default connection-timeout is 5s, so unless you think that is wrong you should start with defaults
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you don't set hostname it will be InetAddress.getLocalHost.getHostAddress
, maybe good to have that as an optional environment variable here?
@@ -47,16 +52,17 @@ akka { | |||
cluster { | |||
shutdown-after-unsuccessful-join-seed-nodes = 60s | |||
|
|||
// FIXME consider setting distributed-data.max-delta-elements = <N> | |||
// FIXME consider setting distributed-data.delta-crdt.max-delta-size = <N> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove, and use defaults until you see a problem.
Only mentioned in migration guide because the defaults were changed (to better defaults).
@pvlugter There are no wip/fixmes in here that can currently be addressed (barring decisions needed) |
@@ -39,6 +42,8 @@ akka { | |||
artery { | |||
enabled = on | |||
transport = tcp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both these are default in Akka 2.6, so not strictly needed
@@ -3,6 +3,9 @@ | |||
akka { | |||
actor { | |||
provider = cluster | |||
allow-java-serialization = off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default in Akka 2.6, so not strictly needed
@@ -39,6 +42,8 @@ akka { | |||
artery { | |||
enabled = on | |||
transport = tcp | |||
// FIXME do we need to set canonical.hostname? | |||
// FIXME do we need to set advanced.tcp.connection-timeout? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default connection-timeout is 5s, so unless you think that is wrong you should start with defaults
@@ -39,6 +42,8 @@ akka { | |||
artery { | |||
enabled = on | |||
transport = tcp | |||
// FIXME do we need to set canonical.hostname? | |||
// FIXME do we need to set advanced.tcp.connection-timeout? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you don't set hostname it will be InetAddress.getLocalHost.getHostAddress
, maybe good to have that as an optional environment variable here?
@@ -47,16 +52,17 @@ akka { | |||
cluster { | |||
shutdown-after-unsuccessful-join-seed-nodes = 60s | |||
|
|||
// FIXME consider setting distributed-data.max-delta-elements = <N> | |||
// FIXME consider setting distributed-data.delta-crdt.max-delta-size = <N> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove, and use defaults until you see a problem.
Only mentioned in migration guide because the defaults were changed (to better defaults).
@@ -3,6 +3,9 @@ | |||
akka { | |||
actor { | |||
provider = cluster | |||
allow-java-serialization = off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow-java-serialization = off |
Addressing FIXMEs in upgrade to Akka 2.6.5
cde3d24
to
fb6e8f3
Compare
Lots of things to discuss here—but all-in-all this branch passes the TCK using the native-image generated.