apache / incubator-streampark

Make stream processing easier! Easy-to-use streaming application development framework and operation platform.
https://streampark.apache.org/
Apache License 2.0
3.8k stars 978 forks source link

[Bug] The class loads InternalConfigHolder as a cache class and regenerates an object when used #3495

Open Xuxiaotuan opened 5 months ago

Xuxiaotuan commented 5 months ago

Search before asking

Java Version

Java 8

Scala Version

2.12.x

StreamPark Version

dev

Flink Version

flink all version

deploy mode

kubernetes-session

What happened

The class loads InternalConfigHolder as a cache class, and an object is regenerated when used (it should be the same one, otherwise the cache will become invalid, and everything will become the default value)

As follows:

  1. Springboot startup image

  2. Springboot startup is completed, and the yaml configuration is refreshed into InternalConfigHolder through EnvInitializer image

  3. After springboot is started, click to start k8s sesssion deploy image

It can be seen that after passing this classloader, InternalConfigHolder regenerates an object

image

Error Exception

No response

Screenshots

No response

Are you willing to submit PR?

Code of Conduct

Xuxiaotuan commented 4 months ago

8f6dc023-7f1b-4684-b6d2-ba67a046c760

Initially springboot service is initialized using java's original classloader

(sun/misc/Launcher$AppClassLoader)

When submitting the k8s flink task, Will use flink

(org/apache/streampark/flink/proxy/ChildFirstClassLoader)

This reinitializes InternalConfigHolder

Xuxiaotuan commented 4 months ago

image

I tried to add an output to InternalConfigHolder, printed it once after the initial service, and then submitted it to the flink environment. Will print again