pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

Connection handshake failed: org.apache.pulsar.client.api.PulsarClientException: Connection already closed

Open balakrishna222111 opened this issue 5 years ago • 7 comments

I had apache pulsar cluster in azure . Now i would like to connect to remote cluster from my local mahcine using Proxy

In **proxy.conf** file i set up configuration like this

--- Broker Discovery ---

zookeeperServers=xx.xx.xx.xx:2181,xx.xx.xx.xx:0:2181,xx.xx.xx.xx::2181

configurationStoreServers=xx.xx.xx.xx::2181,xx.xx.xx.xx::2181,xx.xx.xx.xx:xx:2181

brokerServiceURL=pulsar://xx.xx.xx.xx::6650,xx.xx.xx.xx::6650,xx.xx.xx.xx::6650 brokerServiceURLTLS= brokerWebServiceURL=http://xx.xx.xx.xx::8080,xx.xx.xx.xx::8080,xx.xx.xx.xx::8080

---------------------------------------------------------------------------------------------

In client.conf file i set up configuration like this

webServiceUrl=http://xx.xx.xx.xx:8080,xx.xx.xx.xx:8080,xx.xx.xx.xx:8080

brokerServiceUrl=pulsar://xx.xx.xx.xx:8080,xx.xx.xx.xx:8080,xx.xx.xx.xx:8080

---------------------------------------------------------------------------------------------

After that i ran this command u can see the below logs even proxy ran well

**bin/pulsar proxy **

13:55:44.775 [main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@6bd16207{/lookup,null,AVAILABLE} 13:55:44.788 [main] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@3a0807b7{HTTP/1.1, (http/1.1)}{0.0.0.0:8080} 13:55:44.788 [main] INFO org.eclipse.jetty.server.Server - Started @16022ms 13:55:44.789 [main] INFO org.apache.pulsar.proxy.server.WebServer - Server started at end point http://0.0.0.0:8080

In another terminal

bin/pulsar-client consume my-topic -s "first-subscription"

Then i faced below error

Connection handshake failed: org.apache.pulsar.client.api.PulsarClientException: Connection already closed 13:59:44.816 [pulsar-external-listener-3-1] WARN org.apache.pulsar.client.impl.PulsarClientImpl - [topic: persistent://public/default/my-topic] Could not get connection while getPartitionedTopicMetadata -- Will try again in 2960 ms 13:59:45.079 [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.Connect

balakrishna222111 avatar Dec 23 '20 08:12 balakrishna222111

Could you please help check if the problem only happens when the topic does not exist?

codelipenghui avatar Dec 23 '20 13:12 codelipenghui

@balakrishna222111 Any update for this issue?

codelipenghui avatar Jan 30 '21 16:01 codelipenghui

This also happens when the topic exists, it is sporadic

niushaoda avatar Jan 20 '22 11:01 niushaoda

After this happens, the connection is re-established and the message can still be sent successfully.

niushaoda avatar Jan 20 '22 11:01 niushaoda

image

   I am sending the message asynchronously, the exception is thrown here.

niushaoda avatar Jan 20 '22 12:01 niushaoda

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

codelipenghui avatar Mar 04 '22 07:03 codelipenghui

Hey Team,

similar error we are getting when we are trying the load test with 1000 threads creating producers for sending simple string message & similarly for consuming.

Any suggestions would be really helpful.

anishsurge avatar Nov 04 '22 12:11 anishsurge

Increasing the connectiontimeout & operationtimeout 5-10 minutes made the connection to reestablish and was able to resolve the frequent connection already closed issue

anishsurge avatar Nov 16 '22 11:11 anishsurge