[
https://issues.apache.org/jira/browse/FLINK-7656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16173502#comment-16173502
]
ASF GitHub Bot commented on FLINK-7656:
---------------------------------------
GitHub user fhueske opened a pull request:
https://github.com/apache/flink/pull/4690
[FLINK-7656] [runtime] Switch to user classloader before calling
initializeOnMaster and finalizeOnMaster.
## What is the purpose of the change
Fixes a classloading issue for `OutputFormat`s that implement
`InitializeOnMaster` or `FinalizeOnMaster`. The initialize and finalize methods
are called without setting the context classloader to the usercode classloader.
## Brief change log
* Set the context classloader to the usercode classloader before calling
`InitializeOnMaster.initializeGlobal()` and `FinalizeOnMaster.finalizeGlobal()`
and restore the original classloader afterwards.
* Extend test to check that the correct classloader is set.
## Verifying this change
* Run `JobTaskVertexTest.testOutputFormatVertex()`
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): **no**
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: **no**
- The serializers: **no**
- The runtime per-record code paths (performance sensitive): **no**
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Yarn/Mesos, ZooKeeper: **YES**
## Documentation
- Does this pull request introduce a new feature? **no**
- If yes, how is the feature documented? **n/a**
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/fhueske/flink outputOnMasterFix
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/4690.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4690
----
commit 2dfc8a4550981b9b8c417585dfb5e02b3282c77a
Author: Fabian Hueske <[email protected]>
Date: 2017-09-20T14:26:47Z
[FLINK-7656] [runtime] Switch to user classloader before calling
initializeOnMaster and finalizeOnMaster.
----
> Switch to user ClassLoader when invoking initializeOnMaster finalizeOnMaster
> ----------------------------------------------------------------------------
>
> Key: FLINK-7656
> URL: https://issues.apache.org/jira/browse/FLINK-7656
> Project: Flink
> Issue Type: Bug
> Components: Local Runtime
> Affects Versions: 1.3.2
> Reporter: Fabian Hueske
> Assignee: Fabian Hueske
>
> The contract that Flink provides to usercode is that that the usercode
> classloader is the context classloader whenever usercode is called.
> In {{OutputFormatVertex}} usercode is called in the {{initializeOnMaster()}}
> and {{finalizeOnMaster()}} methods but the context classloader is not set to
> the usercode classloader.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)