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

ASF subversion and git services commented on KUDU-3352:
-------------------------------------------------------

Commit 136a8c21549c9d81d96d8ef3cfa4d200b9325f32 in kudu's branch 
refs/heads/master from Alexey Serbin
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=136a8c2 ]

KUDU-3352 fix handling sockaddr_in in Sockaddr

Since the Sockaddr class has been updated to handle various address
families, an issue with uninitialized memory in the storage_.in.sin_zero
started affecting the behavior of the BytewiseCompare() and HashCode()
methods.  As the result, ReactorThread::FindOrStartConnection() could
create a new connection to the specified remote even if a connection
with the required credentials policy had already been established.

This patch addresses the issue by not counting the padding 'sin_zero'
field of the sockaddr_in structure in the length of Sockaddr::storage_
which is passed to Sockaddr::{BytewiseCompare,HashCode}().

I also added a new test scenario to reproduce the issue, verifying that
the scenario fails if not applying the corresponding part of this patch
to src/kudu/util/net/sockaddr.cc:

  [ RUN      ] SockaddrHashTest.ZeroPadding
  src/kudu/util/net/socket-test.cc:69: Failure
  Expected equality of these values:
    s_in.HashCode()
      Which is: 2868988679
    s_un.HashCode()
      Which is: 1786951233
  [  FAILED  ] SockaddrHashTest.ZeroPadding (0 ms)

Credit goes to Wenzhe Zhou for detecting and troubleshooting the issue.

This is a follow-up to 79079b6b64295b06c5a0f05ed200a55d89bccc47.

Change-Id: I96fee11a4191a4f4240c460db22742880eebe7b5
Reviewed-on: http://gerrit.cloudera.org:8080/18223
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Wenzhe Zhou <[email protected]>
Reviewed-by: Attila Bukor <[email protected]>


> Malfunction in Sockaddr::HashCode() could lead to running out of connections 
> in a busy Kudu cluster
> ---------------------------------------------------------------------------------------------------
>
>                 Key: KUDU-3352
>                 URL: https://issues.apache.org/jira/browse/KUDU-3352
>             Project: Kudu
>          Issue Type: Bug
>          Components: client, master, tserver
>    Affects Versions: 1.13.0, 1.14.0, 1.15.0
>            Reporter: Alexey Serbin
>            Assignee: Alexey Serbin
>            Priority: Major
>
> Since the {{Sockaddr}} class has been updated to handle various address 
> families, an issue with uninitialized memory in the {{storage_.in.sin_zero}} 
> started affecting the behavior of the {{Sockaddr::HashCode()}} method.
> As the result, {{ReactorThread::FindOrStartConnection()}} would create a new 
> connection to the specified remote even if a connection with the required 
> credentials policy had already been established.  In a very busy Kudu cluster 
> that could lead to running out of connections, where an attempt to establish 
> a new connection would fail with {{EADDRNOTAVAIL}} error (Cannot assign 
> requested address).
> Credit goes to [~wzhou] for detecting and troubleshooting the issue.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to