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.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---