[
https://issues.apache.org/jira/browse/FLINK-8876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16387720#comment-16387720
]
ASF GitHub Bot commented on FLINK-8876:
---------------------------------------
Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/5645#discussion_r172508524
--- Diff:
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializer.java
---
@@ -502,6 +572,22 @@ private void readObject(ObjectInputStream in) throws
IOException, ClassNotFoundE
// For testing
//
--------------------------------------------------------------------------------------------
+ private void enterExclusiveThread() {
+ // we use simple get, check, set here, rather than CAS
+ // we don't need lock-style correctness, this is only a
sanity-check and we thus
+ // favor speed at the cost of some false negatives in this check
+ Thread previous = currentThread;
+ if (previous == null) {
+ currentThread = Thread.currentThread();
+ } else {
+ throw new IllegalStateException("Serializer already
accessed by thread " + previous.getName());
--- End diff --
We can also print the current thread for debugging purposes.
> Improve concurrent access handling in stateful serializers
> ----------------------------------------------------------
>
> Key: FLINK-8876
> URL: https://issues.apache.org/jira/browse/FLINK-8876
> Project: Flink
> Issue Type: Improvement
> Components: Core
> Reporter: Stephan Ewen
> Assignee: Stephan Ewen
> Priority: Major
> Fix For: 1.5.0, 1.6.0
>
>
> Some stateful serializers produce incorrect results when accidentally
> accessed by multiple threads concurrently.
> To better catch these cases, I suggest to add concurrency checks that are
> active only when debug logging is enabled, and during test runs.
> This is inspired by Kryo's checks for concurrent access.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)