[jira] [Created] (FLINK-11431) Akka dependency not compatible with java 9 or above

2019-01-24 Thread Matthieu Bonneviot (JIRA)
Matthieu Bonneviot created FLINK-11431:
--

 Summary: Akka dependency not compatible with java 9 or above
 Key: FLINK-11431
 URL: https://issues.apache.org/jira/browse/FLINK-11431
 Project: Flink
  Issue Type: Bug
  Components: Core
Affects Versions: 1.7.1
Reporter: Matthieu Bonneviot


2019-01-24 14:43:52,059 ERROR akka.remote.Remoting  
    - class [B cannot be cast to class [C ([B and [C are in module 
java.base of loader 'bootstrap')
java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C 
are in module java.base of loader 'bootstrap')
    at akka.remote.artery.FastHash$.ofString(LruBoundedCache.scala:18)
    at 
akka.remote.serialization.ActorRefResolveCache.hash(ActorRefResolveCache.scala:61)
    at 
akka.remote.serialization.ActorRefResolveCache.hash(ActorRefResolveCache.scala:55)
    at 
akka.remote.artery.LruBoundedCache.getOrCompute(LruBoundedCache.scala:110)
    at 
akka.remote.RemoteActorRefProvider.resolveActorRef(RemoteActorRefProvider.scala:403)
    at akka.actor.SerializedActorRef.readResolve(ActorRef.scala:433)
    at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at 
java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1250)
    at 
java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2096)
    at 
java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1594)Running
 a jobmanager with java 11 fail with the following call stack:


Flink master is using akka 2.4.20.

After some investigation, the error in akka comes from the following line:
def ofString(s: String): Int = {
val chars = Unsafe.instance.getObject(s, 
EnvelopeBuffer.StringValueFieldOffset).asInstanceOf[Array[Char]]

from java 9 it is now an array of byte. The akka code in the newer version is:
public static int fastHash(String str) {
  ...
if (isJavaVersion9Plus) {
final byte[] chars = (byte[]) instance.getObject(str, 
stringValueFieldOffset);
...
} else {
final char[] chars = (char[]) instance.getObject(str, 
stringValueFieldOffset);
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (FLINK-11413) MetricReporter: "metrics.reporters" configuration has to be provided for reporters to be taken into account

2019-01-23 Thread Matthieu Bonneviot (JIRA)
Matthieu Bonneviot created FLINK-11413:
--

 Summary: MetricReporter: "metrics.reporters" configuration has to 
be provided for reporters to be taken into account
 Key: FLINK-11413
 URL: https://issues.apache.org/jira/browse/FLINK-11413
 Project: Flink
  Issue Type: Bug
  Components: Configuration
Affects Versions: 1.7.1
Reporter: Matthieu Bonneviot


When using java 11, "metrics.reporters" configuration has to be provided for 
reporters to be taken into account.
 
The desired behavior:
The MetricRegistryConfiguration looks for a conf like "metrics.reporters = 
foo,bar", if not found: all reporters that could be found in the configuration 
will be started.
 
In the code is it done bySet includedReporters = 
reporterListPattern.splitAsStream(includedReportersString).collect(Collectors.toSet());
[https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java#L134]
 Definition of splitAsStream: If this pattern does not match any subsequence of 
the input then the resulting stream has just one element, namely the input 
sequence in string form.
It means  reporterListPattern.splitAsStream("") should return "" and so 
includedReporters should have size 1 with "" as unique element


However there is a misbehavior in some version of java 8, it does return empty 
stream.
But working with java 11, the further code does not work: if 
(includedReporters.isEmpty() || includedReporters.contains(reporterName))
[https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java#L145]


I would suggest to filter empty string:
Set includedReporters = 
reporterListPattern.splitAsStream(includedReportersString).*filter(s -> 
!s.isEmpty())*.collect(Collectors.toSet());



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)