Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix fastjson classloader leaked #260

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

banmoy
Copy link
Collaborator

@banmoy banmoy commented Aug 3, 2023

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Which issues of this PR fixes :

Fixes #

Problem Summary(Required) :

Problem

If a job fails many times, flink can warn there is a classloader leak when fastjson serializes/deserializes data
Caused by: java.lang.IllegalStateException: Trying to access closed classloader. Please check if you store classloaders directly or indirectly in static fields. If the stacktrace suggests that the leak occurs in a third party library and cannot be fixed immediately, you can disable this check with the configuration 'classloader.check-leaked-classloader'.
image

Reason

Fastjson uses two global/static configs by default to serialize and deserialize data (SerializeConfig#globalInstance and ParserConfig#global). Flink's classloader mechanism will treat them as classloader leak if a JVM instance run a job in multiple times, such as failover or in session mode. See flink classloader.check-leaked-classloader for details.

Solution

Don't use fastjson's global configs. Instead each sink instance creates and uses it's own configs, and do not shared with other instance

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
  • I have added documentation for my new feature or new function

Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
@banmoy banmoy merged commit 658cfb3 into StarRocks:main Aug 7, 2023
4 checks passed
banmoy added a commit to banmoy/starrocks-connector-for-apache-flink that referenced this pull request Aug 28, 2023
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
banmoy added a commit to banmoy/starrocks-connector-for-apache-flink that referenced this pull request Aug 28, 2023
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
banmoy added a commit to banmoy/starrocks-connector-for-apache-flink that referenced this pull request Aug 28, 2023
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
banmoy added a commit to banmoy/starrocks-connector-for-apache-flink that referenced this pull request Aug 28, 2023
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
banmoy added a commit that referenced this pull request Sep 11, 2023
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
banmoy added a commit that referenced this pull request Sep 11, 2023
Signed-off-by: PengFei Li <lpengfei2016@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants