You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/08/29 08:03:34 UTC

[GitHub] [pulsar] Muyoo opened a new issue #5065: "Connection is already closed" when creating a Producer

Muyoo opened a new issue #5065: "Connection is already closed" when creating a Producer
URL: https://github.com/apache/pulsar/issues/5065
 
 
   After I set up a Pulsar in standalone on MacOS, I get an exception `Connection is already closed` when I create a Producer: 
   ```
   15:53:56.739 [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ClientCnx - [id: 0x3fab3a4b, L:/127.0.0.1:60316 ! R:/127.0.0.1:6650] Disconnected
   15:53:56.742 [pulsar-client-io-1-1] WARN org.apache.pulsar.client.impl.ConnectionPool - [[id: 0x3fab3a4b, L:/127.0.0.1:60316 ! R:/127.0.0.1:6650]] Connection handshake failed: org.apache.pulsar.client.api.PulsarClientException: Connection already closed
   15:53:56.742 [pulsar-client-io-1-1] WARN org.apache.pulsar.client.impl.PulsarClientImpl - [persistent://public/default/wyq-test] Failed to get partitioned topic metadata: org.apache.pulsar.client.api.PulsarClientException: Connection already closed
   Exception in thread "main" org.apache.pulsar.client.api.PulsarClientException: java.util.concurrent.ExecutionException: org.apache.pulsar.client.api.PulsarClientException: Connection already closed
   	at org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:297)
   	at org.apache.pulsar.client.impl.ProducerBuilderImpl.create(ProducerBuilderImpl.java:88)
   	at org.xmuyoo.blueberry.crawling.streams.Publisher.main(Publisher.java:108)
   Caused by: java.util.concurrent.ExecutionException: org.apache.pulsar.client.api.PulsarClientException: Connection already closed
   	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
   	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
   	at org.apache.pulsar.client.impl.ProducerBuilderImpl.create(ProducerBuilderImpl.java:86)
   	... 1 more
   Caused by: org.apache.pulsar.client.api.PulsarClientException: Connection already closed
   	at org.apache.pulsar.client.impl.ClientCnx.channelInactive(ClientCnx.java:220)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:224)
   	at org.apache.pulsar.shade.io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:390)
   	at org.apache.pulsar.shade.io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:355)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:224)
   	at org.apache.pulsar.shade.io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1429)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231)
   	at org.apache.pulsar.shade.io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:947)
   	at org.apache.pulsar.shade.io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:826)
   	at org.apache.pulsar.shade.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
   	at org.apache.pulsar.shade.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
   	at org.apache.pulsar.shade.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:474)
   	at org.apache.pulsar.shade.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
   	at org.apache.pulsar.shade.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
   	at java.lang.Thread.run(Thread.java:748)
   ```
   
   And I run Pulsar in Docker(18.09.2) with the command in the document:
   ```
   $ docker run -it \
     -p 6650:6650 \
     -p 8080:8080 \
     -v $PWD/data:/pulsar/data \
     apachepulsar/pulsar:2.4.0 \
     bin/pulsar standalone
   ```
   There is no ERROR in the log messages.
   
   And my code is here:
   ```Java
   public static void main(String[] args) throws Exception {
       PulsarClient client = PulsarClient.builder()
               .serviceUrl("pulsar://127.0.0.1:6650")
               .build();
       Producer<SeriesData> producer = client.newProducer(Schema.AVRO(SeriesData.class))
               .producerName("publisher-" + SeriesData.class.getSimpleName())
               .topic("persistent://public/default/wyq-test")
               .sendTimeout(10, TimeUnit.SECONDS)
               .blockIfQueueFull(true)
               .enableBatching(true)
               .batchingMaxPublishDelay(100, TimeUnit.MILLISECONDS)
               .create();
   
       producer.close();
       client.close();
   ```
   
   How do I solve this please?
   Thanks!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services