Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulsar client consume command fails with java.lang.IllegalArgumentException: port out of range:-1 #2576

Open
dsambandam opened this issue Sep 13, 2018 · 10 comments

Comments

Projects
None yet
2 participants
@dsambandam
Copy link

commented Sep 13, 2018

Expected behavior

Consume messages with TLS Auth and Authorization.
Below CLI works fine without TLS AUth.
Kindly suggest if I am doing anything wrong here?

Actual behavior

./bin/pulsar-client consume persistent://apps/data/sim -s my-topic -n 10 -r 0

webServiceUrl=https://broker1:8443/
brokerServiceUrl=pulsar+ssl://broker1:6651/
useTls=true
tlsTrustCertsFilePath=/Path/my-ca/certs/ca.cert.pem
#tlsEnableHostnameVerification=true
authPlugin=org.apache.pulsar.client.impl.auth.AuthenticationTls
authParams=tlsCertFile:/Path/my-ca/broker.cert.pem,tlsKeyFile:/Path/my-ca/broker.key-pk8.pem
3.2" 0

15:09:30.864 [pulsar-io-21-10] INFO org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:45440] Client successfully authenticated with tls role admin and originalPrincipal null

15:09:35.222 [pulsar-io-21-10] INFO org.apache.pulsar.broker.service.ServerCnx - Closed connection from /127.0.0.1:45440

15:04:50.758 [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ConnectionPool - [[id: 0xf472fa68, L:/127.0.0.1:45398 - R:localhost/127.0.0.1:6651]] Connected to server
2018-09-13 15:04:50,772 pulsar-client-io-1-1 DEBUG AsyncLogger.ThreadNameStrategy=UNCACHED (user specified null, default is UNCACHED)
15:04:50.980 [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ConsumerStatsRecorderImpl - Starting Pulsar consumer perf with config: {
"topicNames" : [ "persistent://apps/data/sim" ],
"topicsPattern" : null,
"subscriptionName" : "vmb",
"subscriptionType" : "Exclusive",
"receiverQueueSize" : 1000,
"acknowledgementsGroupTimeMicros" : 100000,
"maxTotalReceiverQueueSizeAcrossPartitions" : 50000,
"consumerName" : null,
"ackTimeoutMillis" : 0,
"priorityLevel" : 0,
"cryptoFailureAction" : "FAIL",
"properties" : { },
"readCompacted" : false,
"subscriptionInitialPosition" : "Latest",
"patternAutoDiscoveryPeriod" : 1
}
15:04:50.984 [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ConsumerStatsRecorderImpl - Pulsar client config: {
"serviceUrl" : "pulsar+ssl://localhost:6651/",
"operationTimeoutMs" : 30000,
"statsIntervalSeconds" : 60,
"numIoThreads" : 1,
"numListenerThreads" : 1,
"connectionsPerBroker" : 1,
"useTcpNoDelay" : true,
"useTls" : true,
"tlsTrustCertsFilePath" : "/PATH/certs/ca.cert.pem",
"tlsAllowInsecureConnection" : true,
"tlsHostnameVerificationEnable" : false,
"concurrentLookupRequest" : 5000,
"maxLookupRequest" : 50000,
"maxNumberOfRejectedRequestPerConnection" : 50,
"keepAliveIntervalSeconds" : 30
}
15:04:51.008 [pulsar-client-io-1-1] WARN org.apache.pulsar.client.impl.BinaryProtoLookupService - [persistent://apps/data/sim] invalid url : port out of range:-1
java.lang.IllegalArgumentException: port out of range:-1

Steps to reproduce

  1. Enable TLS Auth, Update Broker and Client configuration as mentioned above
  2. Try consuming messages from existing topics after broker restart
  3. Consumption fails with Port out of range error.

System configuration

Pulsar version: 2.1

@dsambandam dsambandam changed the title Pulsar client consume command fails with Pulsar client consume command fails with java.lang.IllegalArgumentException: port out of range:-1 Sep 13, 2018

@sijie

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2018

@dsambandam what is your broker url? is it broker1? or broker1 was replacing the real domain name when you posting it?

@dsambandam

This comment has been minimized.

Copy link
Author

commented Sep 14, 2018

@sijie I replaced the real hostname with broker1 when I posted it.

@dsambandam

This comment has been minimized.

Copy link
Author

commented Sep 14, 2018

@sijie is this a bug as the same command runs fine with TLS disabled. Kindly confirm.

@dsambandam

This comment has been minimized.

Copy link
Author

commented Sep 14, 2018

Stack Trace:
java.lang.IllegalArgumentException: port out of range:-1

at java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143) ~[?:1.8.0_171]
at java.net.InetSocketAddress.createUnresolved(InetSocketAddress.java:254) ~[?:1.8.0_171]
at org.apache.pulsar.client.impl.BinaryProtoLookupService.lambda$null$2(BinaryProtoLookupService.java:109) ~[org.apache.pulsar-pulsar-client-original-2.1.0-incubating.jar:2.1.0-incubating]
at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:656) [?:1.8.0_171]
at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632) [?:1.8.0_171]
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) [?:1.8.0_171]
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1962) [?:1.8.0_171]
at org.apache.pulsar.client.impl.ClientCnx.handleLookupResponse(ClientCnx.java:369) [org.apache.pulsar-pulsar-client-original-2.1.0-incubating.jar:2.1.0-incubating]
at org.apache.pulsar.common.api.PulsarDecoder.channelRead(PulsarDecoder.java:115) [org.apache.pulsar-pulsar-common-2.1.0-incubating.jar:2.1.0-incubating]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1389) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1171) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1205) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1414) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:945) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:806) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:404) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:304) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-all-4.1.22.Final.jar:4.1.22.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: port out of range:-1
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:943)
at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
at org.apache.pulsar.client.impl.BinaryProtoLookupService.lambda$null$2(BinaryProtoLookupService.java:138)
at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:656)
at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1962)
at org.apache.pulsar.client.impl.ClientCnx.handleLookupResponse(ClientCnx.java:369)
at org.apache.pulsar.common.api.PulsarDecoder.channelRead(PulsarDecoder.java:115)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1389)
at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1171)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1205)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1414)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:945)
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:806)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:404)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:304)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: port out of range:-1
at java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
at java.net.InetSocketAddress.createUnresolved(InetSocketAddress.java:254)

@sijie

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2018

@dsambandam : what are the command you are using for initializing cluster metadata?

especially what did you provide for --web-service-url-tls and --broker-service-url-tls?

$ bin/pulsar initialize-cluster-metadata \
  --cluster pulsar-cluster-1 \
  --zookeeper zk1.us-west.example.com:2181 \
  --configuration-store zk1.us-west.example.com:2181 \
  --web-service-url http://pulsar.us-west.example.com:8080 \
  --web-service-url-tls https://pulsar.us-west.example.com:8443 \
  --broker-service-url pulsar://pulsar.us-west.example.com:6650 \
  --broker-service-url-tls pulsar+ssl://pulsar.us-west.example.com:6651
@dsambandam

This comment has been minimized.

Copy link
Author

commented Sep 14, 2018

./bin/pulsar initialize-cluster-metadata --cluster cluster1
--zookeeper zk1:2181
--configuration-store zk1:2184
--web-service-url http://broker1:8080
--web-service-url-tls https://broker1:8443
--broker-service-url pulsar://broker1:6650
--broker-service-url-tls pulsar+ssl://broker1:6651

@dsambandam

This comment has been minimized.

Copy link
Author

commented Sep 17, 2018

@sijie - Is this a bug as the command runs fine without any TLS Auth. Also, please suggest if there are any work around that I can try it out to consume data ?

@sijie sijie self-assigned this Sep 19, 2018

@sijie sijie added the type/question label Sep 19, 2018

@sijie

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2018

@dsambandam I think the exception is quite similar ast the issue reported here: #1022 can you inspect your tls related service urls and make sure they don't have any special characters at the end of the hostname?

@dsambandam

This comment has been minimized.

Copy link
Author

commented Sep 19, 2018

@sijie I don't have any special character in my service urls. In that case my command that runs fine with no authentication enabled should also fail right ? That gets completed successfully with no issues.

@sijie sijie removed the triage/week-38 label Jan 25, 2019

@sijie

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2019

@dsambandam do you have any updates on this issue? is the problem resolved with authentication enabled?

@sijie sijie added the triage/week-4 label Jan 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.