You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2024/09/03 03:26:40 UTC
[PR] [core] Fix 'Trying to access closed classloader' in Flink [paimon]
JingsongLi opened a new pull request, #4116:
URL: https://github.com/apache/paimon/pull/4116
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
<!-- Linking this pull request to the issue -->
This fixes:
https://github.com/apache/paimon/actions/runs/10645769652/job/29511901738
```
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'.
```
Flink will close previous classloader, so in the async thread pool, we should set thread classloader.
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Fix 'Trying to access closed classloader' in Flink [paimon]
Posted by "leaves12138 (via GitHub)" <gi...@apache.org>.
leaves12138 merged PR #4116:
URL: https://github.com/apache/paimon/pull/4116
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Fix 'Trying to access closed classloader' in Flink [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #4116:
URL: https://github.com/apache/paimon/pull/4116#discussion_r1741627742
##########
paimon-common/src/main/java/org/apache/paimon/utils/ThreadPoolUtils.java:
##########
@@ -120,17 +120,29 @@ private void advanceIfNeeded() {
public static <U> void randomlyOnlyExecute(
ExecutorService executor, Consumer<U> processor, Collection<U> input) {
List<Future<?>> futures = new ArrayList<>(input.size());
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
for (U u : input) {
- futures.add(executor.submit(() -> processor.accept(u)));
+ futures.add(
+ executor.submit(
+ () -> {
+ Thread.currentThread().setContextClassLoader(cl);
+ processor.accept(u);
Review Comment:
No need, the thread pool is only for this usage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Fix 'Trying to access closed classloader' in Flink [paimon]
Posted by "leaves12138 (via GitHub)" <gi...@apache.org>.
leaves12138 commented on code in PR #4116:
URL: https://github.com/apache/paimon/pull/4116#discussion_r1741598775
##########
paimon-common/src/main/java/org/apache/paimon/utils/ThreadPoolUtils.java:
##########
@@ -120,17 +120,29 @@ private void advanceIfNeeded() {
public static <U> void randomlyOnlyExecute(
ExecutorService executor, Consumer<U> processor, Collection<U> input) {
List<Future<?>> futures = new ArrayList<>(input.size());
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
for (U u : input) {
- futures.add(executor.submit(() -> processor.accept(u)));
+ futures.add(
+ executor.submit(
+ () -> {
+ Thread.currentThread().setContextClassLoader(cl);
+ processor.accept(u);
Review Comment:
After processor.accept(u); set the classloader back to previous?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org