[
https://issues.apache.org/jira/browse/FLINK-8876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389739#comment-16389739
]
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_r172893030
--- Diff:
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java
---
@@ -163,8 +224,19 @@ public T copy(T from, T reuse) {
@Override
public void copy(DataInputView source, DataOutputView target) throws
IOException {
- T value = deserialize(source);
- serialize(value, target);
+ if (CONCURRENT_ACCESS_CHECK) {
+ enterExclusiveThread();
+ }
+
+ try {
+ T value = deserialize(source);
--- End diff --
Have to point out that after `deserialize()` the checks in copy() are
ineffective as the `currentThread` field has already been nulled. In other
words, we guard against concurrent access before deserialize(), and within
deserialize()&serialize(), but not between deserialize()&serialize() or after
serialize().
This isn't a _problem_ as all code is actually covered, but we may want to
document that.
> 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)