[ https://issues.apache.org/jira/browse/FLINK-6714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16024995#comment-16024995 ]
ASF GitHub Bot commented on FLINK-6714: --------------------------------------- Github user EronWright commented on a diff in the pull request: https://github.com/apache/flink/pull/3987#discussion_r118530090 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/state/DefaultOperatorStateBackend.java --- @@ -185,13 +185,18 @@ public void dispose() { new HashMap<>(registeredStates.size()); // eagerly create deep copies of the list states in the sync phase, so that we can use them in the async writing - for (Map.Entry<String, PartitionableListState<?>> entry : this.registeredStates.entrySet()) { - - PartitionableListState<?> listState = entry.getValue(); - if (null != listState) { - listState = listState.deepCopy(); + ClassLoader snapshotClassLoader = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(userClassloader); --- End diff -- (nitpick) `Thread.currentThread().setContextClassLoader(userClassloader)` should occur before the `try` block is entered. Setting the TCCL occurs in about a half-dozen places in Flink, and this is inconsistent with most of them. > Operator state backend should set user classloader as context classloader > when snapshotting > ------------------------------------------------------------------------------------------- > > Key: FLINK-6714 > URL: https://issues.apache.org/jira/browse/FLINK-6714 > Project: Flink > Issue Type: Bug > Components: State Backends, Checkpointing > Reporter: Tzu-Li (Gordon) Tai > Assignee: Tzu-Li (Gordon) Tai > Priority: Blocker > > Now that the operator state backend creates a deep copy of the state during > the synchronous part of async checkpoints, it needs to set the user > classloader as the thread context classloader, otherwise serializers that > uses serialization for copying will use the wrong classloader when > deserializing the copy. -- This message was sent by Atlassian JIRA (v6.3.15#6346)