Hi, I am using Flink with Standalone deployment ...
# troubleshooting
s
Hi, I am using Flink with Standalone deployment model in K8 and HA enabled. I have my apps running in production. My flink app uses a specific jackson-databind library. When I am upgrading the jackson library in my gradle file, my flink job fails to start. I see below error. The application keeps on restarting. The application becomes stable once I delete the jobgraph. Can someone please suggest if theres anything i can do get the job graph updated automatically due to version mismatch ":"Source Source: RoutingEventTransformerJob registering reader for parallel task 0 (#0) @ 10.6.160.151","logger_name":"org.apache.flink.runtime.source.coordinator.SourceCoordinator","thread_name":"SourceCoordinator-Source: RoutingEventTransformerJob","level":"INFO","level_value":20000,"@environment":"dev"} {"@timestamp":"2024-01-21T225455.425Z","@version":"1","message":"Source Source: RoutingEventTransformerJob registering reader for parallel task 1 (#0) @ 10.6.154.127","logger_name":"org.apache.flink.runtime.source.coordinator.SourceCoordinator","thread_name":"SourceCoordinator-Source: RoutingEventTransformerJob","level":"INFO","level_value":20000,"@environment":"dev"} {"@timestamp":"2024-01-21T225455.481Z","@version":"1","message":"Source: RoutingEventTransformerJob -> Filter -> Map -> Flat Map -> Filter -> Sink: Writer -> Sink: Committer (2/2) (7d96309a3a32b0b0330e5bf6d394ddb7_cbc357ccb763df2852fee8c4fc7d55f2_1_0) switched from INITIALIZING to RUNNING.","logger_name":"org.apache.flink.runtime.executiongraph.ExecutionGraph","thread_name":"flink-akka.actor.default-dispatcher-4","level":"INFO","level_value":20000,"@environment":"dev"} {"@timestamp":"2024-01-21T225455.489Z","@version":"1","message":"Fatal error occurred in the cluster entrypoint. ","logger_name":"org.apache.flink.runtime.entrypoint.ClusterEntrypoint","thread_name":"flink-akka.actor.defa ult-dispatcher-4","level":"ERROR","level_value":40000,"stack_trace":"java.io.InvalidClassException: com.fasterxml.jackson.databind.cfg.MapperConfigBase; local class incompatible: stream classdesc serialVersionUID = 6477281625127050473, local class serialVersionUID = -1012789217358583860\n\tat java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:560)\n\tat java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2020)\n\tat java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1870)\n\tat java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2020)\n\tat java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1870)\n\tat java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2201)\n\tat java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1687)\n\tat java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2496)\n\tat java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2390)\n\tat java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2228)\n\tat java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1687)\n\tat java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2496)\n\tat java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2390)\n\tat java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2228)\n\tat java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1687)\n\tat java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2496)\n\tat java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2390)\n\tat java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2228)\n\tat java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1687)\n\tat java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2496)\n\tat java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2390)\n\tat java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2228)\n\tat java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1687)\n\tat java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2496)\n\tat java.io.ObjectInputStream....\n","@environment":"dev"} {"@timestamp":"2024-01-21T225455.491Z","@version":"1","message":"Shutting StandaloneApplicationClusterEntryPoint down with application status UNKNOWN. Diagnostics Cluster entrypoint has been closed externally..","logger_name":"org.apache.flink.runtime.entrypoint.ClusterEntrypoint"," thread_name":"StandaloneApplicationClusterEntryPoint shutdown hook","level":"INFO","level_value":20000,"@environment":"dev"}
t
Ah, I see what’s happening here. You’re in the thick of a classic library version conflict in the Java world, compounded by the intricacies of Flink’s distributed nature. The error message you’re seeing, especially the InvalidClassException related to MapperConfigBase, is a telltale sign of a serialization issue. This usually happens when different nodes in your Flink cluster end up using incompatible versions of a library, in this case, jackson-databind. When you update a library like Jackson in a Flink job, every node in your cluster needs to use the same updated version to avoid serialization issues. The job graph, which represents the topology of your Flink job, gets serialized and distributed across the cluster. If the job graph was serialized with a different version of the library than what’s currently available on a node, deserialization will fail, leading to errors like the one you’re seeing.
Now, regarding your question about updating the job graph automatically to handle the version mismatch, there’s no out-of-the-box solution for this in Flink. The job graph is generated at the job submission time based on the current code and library dependencies. If those dependencies change, the safest and most straightforward approach is to cancel the current job and submit a new job with the updated dependencies. However, to mitigate this kind of issue in the future, you might consider the following strategies: a. Package your job with all dependencies: Use tools like Gradle or Maven to build a fat jar that includes all your job’s dependencies. This way, you ensure that your job runs with the exact versions of libraries it was built with, regardless of what’s available on the cluster nodes. b. Use containerization: If you’re running Flink on Kubernetes, consider packaging your job and its dependencies into a Docker image. This approach encapsulates the job and its environment, ensuring consistency across all deployments. c. Libraries upgrade policy: Implement a policy for upgrading libraries that includes testing in a staging environment that mirrors production as closely as possible. This can help catch serialization and other compatibility issues before they affect your production jobs. d. Externalized checkpoint: To make your jobs more resilient to failures and changes, consider using Flink’s externalized checkpoints feature. This allows you to resume a job from a checkpoint even after the job has been updated or changed. Remember, when dealing with distributed systems like Flink, consistency across all nodes is key to avoiding runtime issues. It might require a bit more legwork when it comes to updating dependencies, but it pays off in terms of stability and reliability of your data processing jobs.