Kimmo Sääskilahti
10/24/2023, 12:13 PMKimmo Sääskilahti
10/24/2023, 12:25 PMKimmo Sääskilahti
10/24/2023, 12:26 PMAleksandr Pilipenko
10/24/2023, 12:28 PMAleksandr Pilipenko
10/24/2023, 12:30 PMKimmo Sääskilahti
10/24/2023, 12:33 PMsoftware.amazon.awssdk:aws-crt-client:2.17.204-PREVIEW, because the Timestream sink connector has refused to work with new versions 😞
Should we then just fork the Timestream Sink connector and change it so that we can use a recent version of aws-crt-client 🤔 Or create a GitHub issue to ask for updating to most recent version.Aleksandr Pilipenko
10/24/2023, 12:38 PMWe have 2.21.5 for all AWS SDK dependencies except forI see that code in Github uses newer version: 2.20.101, are you using older revision? https://github.com/awslabs/amazon-timestream-tools/blob/mainline/integrations/flink_connector/flink-connector-timestream/pom.xml#L92, because the Timestream sink connector has refused to work with new versionssoftware.amazon.awssdk:aws-crt-client:2.17.204-PREVIEW
Kimmo Sääskilahti
10/24/2023, 12:46 PMKimmo Sääskilahti
10/24/2023, 1:18 PMCause: java.lang.NoSuchMethodError: 'software.amazon.awssdk.http.crt.AwsCrtAsyncHttpClient$Builder software.amazon.awssdk.http.crt.AwsCrtAsyncHttpClient$Builder.maxConcurrency(int)'
Apparently the Builder method Builder.maxConcurrency expects Integer instead of int? I have no idea why it breaks. The configuration in WriteClientConfig uses int for the value. In the old PREVIEW version, it still expected int and everything worked fine for us.Kimmo Sääskilahti
10/24/2023, 1:20 PMKimmo Sääskilahti
10/25/2023, 7:55 AMAleksandr Pilipenko
10/25/2023, 8:19 AMKimmo Sääskilahti
11/16/2023, 8:16 AMbuild.gradle did not fix the issue. We still ran into deadlocks in the Timestream sink connector. It just took some time for the deadlock to happen.
What we're trying now is to upgrade BOM to ensure that a recent enough AWS SDK version is enforced in all dependencies. Looking good so far 🤞Kimmo Sääskilahti
11/16/2023, 9:16 AMAleksandr Pilipenko
11/16/2023, 9:47 AMKimmo Sääskilahti
11/16/2023, 9:54 AM// Force AWS SDK update by adding a platform dependency
// <https://docs.aws.amazon.com/managed-flink/latest/java/troubleshooting-async-deadlock-update-java-apps.html>
flinkShadowJar(platform("software.amazon.awssdk:bom:2.20.144"))
We have a self-compiled JAR of flink-connector-timestream in our libs folder that we include like this:
flinkShadowJar files('libs/flink-connector-timestream-0.4-SNAPSHOT.jar')
If I do ./gradlew -q dependencies | grep aws, all dependencies are either 2.20.144 or 2.21.5 (which both should contain the fix).
flink-connector-timestream also contains this in the pom to force dependencies:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.20.101</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
What we haven't tried yet is changing this to 2.20.144 before compiling the JAR. Not sure if that would help anything though.Kimmo Sääskilahti
11/16/2023, 9:56 AMenforcedPlatform in our build.gradle, it should force dependencies instead of "recommending" them like platform does?
However often BOMs are not only providing versions as recommendations, but also a way to override any other version found in the graph. You can enable this behavior by using the enforcedPlatform keyword, instead of platform, when importing the BOM:
https://docs.gradle.org/current/userguide/platforms.html#sub:bom_importAleksandr Pilipenko
11/16/2023, 10:03 AMKimmo Sääskilahti
11/27/2023, 8:08 AMenforcedPlatform to enforce the versions of AWS SDK in the runtime to 2.20.144. This did not help either, deadlock happened again. Luckily this time we were clever enough to let this run long enough in the test environment before deploying to production 😄Kimmo Sääskilahti
11/27/2023, 10:27 AMAleksandr Pilipenko
11/27/2023, 10:33 AMKimmo Sääskilahti
11/27/2023, 10:41 AMplugins {
id 'scala'
id 'application'
id("com.github.maiflai.scalatest") version "0.32"
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
ext {
flinkVersion = '1.15.2'
scalaBinaryVersion = '2.12'
slf4jVersion = '1.7.32'
log4jVersion = '2.17.1'
awsSDKVersion = '2.20.144'
circeVersion = '0.14.6'
javaVersion = JavaVersion.VERSION_11
}
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(ScalaCompile) {
scalaCompileOptions.additionalParameters = [
"-deprecation",
"-feature",
"-unchecked",
"-language:implicitConversions",
"-language:higherKinds",
"-language:existentials",
"-language:postfixOps",
"-Ywarn-unused"
]
}
repositories {
mavenCentral()
maven {
url "<https://repository.apache.org/content/repositories/snapshots>"
mavenContent {
snapshotsOnly()
}
}
}
// NOTE: We cannot use "compileOnly" or "shadow" configurations since then we could not run code
// in the IDE or with "gradle run". We also cannot exclude transitive dependencies from the
// shadowJar yet (see <https://github.com/johnrengelman/shadow/issues/159>).
// -> Explicitly define the // libraries we want to be included in the "flinkShadowJar" configuration!
configurations {
flinkShadowJar
// always exclude these (also from transitive dependencies) since they are provided by Flink
flinkShadowJar.exclude group: 'org.apache.flink', module: 'force-shading'
flinkShadowJar.exclude group: 'com.google.code.findbugs', module: 'jsr305'
flinkShadowJar.exclude group: 'org.slf4j'
flinkShadowJar.exclude group: 'org.apache.logging.log4j'
}
dependencies {
// --------------------------------------------------------------
// Compile-time dependencies that should NOT be part of the
// shadow jar and are provided in the lib folder of Flink
// --------------------------------------------------------------
implementation "org.apache.flink:flink-json:${flinkVersion}"
implementation "org.apache.flink:flink-clients:${flinkVersion}"
implementation "org.scala-lang:scala-library:${scalaBinaryVersion}.17"
implementation "com.amazonaws:aws-kinesisanalytics-runtime:1.2.0"
// --------------------------------------------------------------
// Dependencies that should be part of the shadow jar, e.g.
// connectors. These must be in the flinkShadowJar configuration!
// --------------------------------------------------------------
flinkShadowJar "org.apache.flink:flink-connector-kinesis:${flinkVersion}"
// Fixes AWSConfigConstants being empty
flinkShadowJar "org.apache.flink:flink-connector-aws-base:${flinkVersion}"
// Force AWS SDK update by adding a platform dependency
// <https://docs.aws.amazon.com/managed-flink/latest/java/troubleshooting-async-deadlock-update-java-apps.html>
flinkShadowJar(enforcedPlatform("software.amazon.awssdk:bom:2.20.144"))
// Timestream sink connector
flinkShadowJar files('libs/flink-connector-timestream-0.4-SNAPSHOT.jar')
flinkShadowJar "org.projectlombok:lombok:1.18.22"
flinkShadowJar "software.amazon.awssdk:aws-crt-client:${awsSDKVersion}"
flinkShadowJar "software.amazon.awssdk:timestreamwrite:${awsSDKVersion}"
}
// make compileOnly dependencies available for tests:
sourceSets {
main.compileClasspath += configurations.flinkShadowJar
main.runtimeClasspath += configurations.flinkShadowJar
test.compileClasspath += configurations.flinkShadowJar
test.runtimeClasspath += configurations.flinkShadowJar
javadoc.classpath += configurations.flinkShadowJar
}
run.classpath = sourceSets.main.runtimeClasspath
shadowJar {
configurations = [project.configurations.flinkShadowJar]
}Aleksandr Pilipenko
11/27/2023, 3:09 PMflink-connector-kinesis with your dependencies. Are you using Kinesis sink in your application? If so, kinesis connector shade AWS SDK classes, which needs to be replaced in order to resolve the issue.Kimmo Sääskilahti
11/28/2023, 6:29 AMKimmo Sääskilahti
11/28/2023, 10:08 AMCaused by: java.lang.ClassNotFoundException: org.apache.flink.kinesis.shaded.software.amazon.awssdk.core.internal.interceptor.HttpChecksumRequiredInterceptor
Any idea what part from AWS SDK I'm now missing?Kimmo Sääskilahti
11/28/2023, 10:09 AMshadowJar {
configurations = [project.configurations.flinkShadowJar]
// Remove all shaded dependencies to fix the deadlock issue
// <https://docs.aws.amazon.com/managed-flink/latest/java/troubleshooting-async-deadlock-update-java-apps.html>
exclude("org/apache/flink/kinesis/shaded/software/amazon/awssdk/**/*.class")
exclude("org/apache/flink/kinesis/shaded/org/reactivestreams/**/*.class")
exclude("org/apache/flink/kinesis/shaded/io/netty/**/*.class")
exclude("org/apache/flink/kinesis/shaded/com/typesafe/netty/**/*.class")
relocate("software.amazon.awssdk", "org.apache.flink.kinesis.shaded.software.amazon.awssdk")
relocate("org.reactivestreams", "org.apache.flink.kinesis.shaded.org.reactivestreams")
relocate("io.netty", "org.apache.flink.kinesis.shaded.io.netty")
relocate("com.typesafe.netty", "org.apache.flink.kinesis.shaded.com.typesafe.netty")
}Kimmo Sääskilahti
11/28/2023, 10:09 AMflinkShadowJar("software.amazon.awssdk:kinesis:${awsSDKVersion}")
flinkShadowJar("software.amazon.awssdk:sts:${awsSDKVersion}")
flinkShadowJar("software.amazon.awssdk:netty-nio-client:${awsSDKVersion}")Aleksandr Pilipenko
11/28/2023, 10:58 AM*.class for sdk classes. As far as I know this interceptor does not strictly necessary for correct functioning of sdk.
exclude("org/apache/flink/kinesis/shaded/software/amazon/awssdk/**/*.class") -> exclude("org/apache/flink/kinesis/shaded/software/amazon/awssdk/**/*")
• exclude and replace with new version to point to new version of interceptor class.Aleksandr Pilipenko
11/28/2023, 11:40 AMWe’re using Kinesis source in our application!If it used only as a source - it shouldn’t cause this issue.
Kimmo Sääskilahti
11/29/2023, 7:22 AM