You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "keith.paulson (Jira)" <ji...@apache.org> on 2023/04/19 21:51:00 UTC

[jira] [Commented] (KAFKA-8154) Buffer Overflow exceptions between brokers and with clients

    [ https://issues.apache.org/jira/browse/KAFKA-8154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17714323#comment-17714323 ] 

keith.paulson commented on KAFKA-8154:
--------------------------------------

I'm getting this error now, kafka 3.4 with BouncyCastle FIPS.

The BC libraries uses a fixed 16k for buffer size, as opposed to java ssl, which uses a calculation to determine it.

The part that confuses me is that we use Utils.ensureCapacity to adjust buffers, and this uses the conditional 
{code:java}
if (newLength > existingBuffer.capacity()) {code}
But the overflow check is
{code:java}
netWriteBuffer.limit() >= currentNetWriteBufferSize {code}
The case where capacity is 16k, and newLength is the same, buffer size won't be changed, but then the overflow condition would be immediately hit.

Should the second test be changed to '>' ? 
There should be no terminating character, so x bytes can be written to a buffer of size x – or is there a reason we want an extra byte size?

 

> Buffer Overflow exceptions between brokers and with clients
> -----------------------------------------------------------
>
>                 Key: KAFKA-8154
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8154
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 2.1.0
>            Reporter: Rajesh Nataraja
>            Priority: Major
>         Attachments: server.properties.txt
>
>
> https://github.com/apache/kafka/pull/6495
> https://github.com/apache/kafka/pull/5785



--
This message was sent by Atlassian Jira
(v8.20.10#820010)