pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

fix connect zookeeper slow for getHostName fail

Open wangjialing218 opened this issue 3 years ago • 3 comments

Motivation

I met same issue with #14578, broker cannot start due to fail to connect to zookeeper with ConnectionLoss error, and zookeeper shell can connect but cost about 20s to finish the connection.

After some investigation, I found it's related with zk server host name resolver. It happens when zookeeper connection is configed with IP address in broker.conf, and there is no host name configed for the IP address. in zookeeper client, it will call InetSocketAddress.getHostName() when connecting to server and block for 20s in this condition. https://github.com/apache/zookeeper/blob/c94473d2a18b718495225c3497693b58591cd209/zookeeper-server/src/main/java/org/apache/zookeeper/SaslServerPrincipal.java#L59

Maybe it will cause broker got ConnectionLoss error.

Modifications

add Server Principal setting when create zookeeper client to avoid call InetSocketAddress.getHostName()

Documentation

  • [x] no-need-doc

wangjialing218 avatar May 16 '22 10:05 wangjialing218

Hi @eolivelli Could you help review this patch ?

Technoboy- avatar May 18 '22 03:05 Technoboy-

Hi @eolivelli Could you help review this patch ?

Technoboy- avatar May 18 '22 03:05 Technoboy-

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar Jun 18 '22 02:06 github-actions[bot]