[
https://issues.apache.org/jira/browse/FLINK-23598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18120654#comment-18120654
]
Zhe Wang commented on FLINK-23598:
----------------------------------
I checked this against current master (0897586aa505). The double position
advance is still present: writeBytes("AB") reports length 4 instead of 2.
Comparing the unmodified implementation with DataOutputStream also shows that a
following write leaves a gap, and a small initial buffer can make
wrapAsByteBuffer() throw because its limit exceeds capacity.
The DataOutput contract requires one low-order byte per character. A minimal
fix would remove the extra position increment and add focused tests for empty
input, low-byte characters, prefixed/appended writes and buffer growth. I have
not identified a production caller in the core/runtime source search, so I am
not claiming a current job-level incident or measured external usage.
I saw the earlier work in PR #23563 by all-cloudz and the older linked
comparison branch. The PR was closed for inactivity rather than a technical
rejection. Is this contract fix still desired, and would it be appropriate for
me to continue the ticket, or should we coordinate with the original author to
resume #23563? I would be happy to help either way.
> DataOutputSerializer.writeBytes updates position twice
> ------------------------------------------------------
>
> Key: FLINK-23598
> URL: https://issues.apache.org/jira/browse/FLINK-23598
> Project: Flink
> Issue Type: Bug
> Components: API / Core
> Affects Versions: 1.13.0
> Reporter: nihileon
> Priority: Critical
> Labels: pull-request-available
> Attachments: image-2021-08-03-16-07-17-790.png,
> image-2021-08-03-16-07-40-338.png, image-2021-08-03-16-08-09-249.png
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> DataOutputSerializer.writeBytes updates this.position twice, which only need
> to be update once.
> If the initiate position is 0 and I write a string of length 10, the position
> will be updated to 20.
> !image-2021-08-03-16-07-17-790.png|width=762,height=372!!image-2021-08-03-16-07-40-338.png|width=744,height=166!
> !image-2021-08-03-16-08-09-249.png|width=698,height=269!
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)