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

Error parsing host address when executing queries #4668

Closed
mmajis opened this issue Feb 28, 2020 · 7 comments · Fixed by #5012
Closed

Error parsing host address when executing queries #4668

mmajis opened this issue Feb 28, 2020 · 7 comments · Fixed by #5012
Assignees

Comments

@mmajis
Copy link

mmajis commented Feb 28, 2020

Describe the bug

Running a push query in ksqldb v0.7.1 errors out with Error parsing host address http://<docker network host address>:8088/. Expected format host:port.

Having had a quick look at the code, it looks like StreamsConfig.APPLICATION_SERVER_CONFIG has wrong format when executing the query.

To Reproduce

  1. Clone this repo: https://github.com/mmajis/ksqldb-query-bug-repro
  2. Put your confluent cloud api key and secret in a .env file inside the repo to configure Confluent Cloud connection:
CC_API_KEY=<your api key>
CC_API_SECRET=<your api secret>
CC_ADDRESS=<your confluent cloud bootstrap server address and port>
  1. docker-compose up -d
  2. docker-compose exec ksqldb-cli bash
  3. LOG_DIR=. ksqldb http://ksql-server:8088
  4. Create a stream:
  CREATE STREAM my_stream (my_value VARCHAR) WITH (
  VALUE_FORMAT = 'JSON',
  KAFKA_TOPIC = 'my_stream_topic', 
  PARTITIONS=1, 
  REPLICAS=3);
  1. SELECT * FROM my_stream EMIT CHANGES;

Expected behavior

Expected the query SELECT * FROM my_stream EMIT CHANGES; to start running.

Actual behaviour

The ksqlDB-cli outputs this error: Error parsing host address http://<docker-compose_ksql-server_hostname>:8088/. Expected format host:port.

Stack trace in ksqldb-cli log:

[2020-02-27 18:53:05,739] ERROR Error parsing host address http://1130da4e15fb:8088/. Expected format host:port.
org.apache.kafka.streams.KafkaStreams.parseHostInfo(KafkaStreams.java:818)
org.apache.kafka.streams.KafkaStreams.<init>(KafkaStreams.java:707)
org.apache.kafka.streams.KafkaStreams.<init>(KafkaStreams.java:584)
io.confluent.ksql.query.KafkaStreamsBuilderImpl.buildKafkaStreams(KafkaStreamsBuilderImpl.java:43)
io.confluent.ksql.query.QueryExecutor.buildTransientQuery(QueryExecutor.java:165)
io.confluent.ksql.engine.EngineExecutor.executeQuery(EngineExecutor.java:129)
io.confluent.ksql.engine.KsqlEngine.executeQuery(KsqlEngine.java:215)
io.confluent.ksql.rest.server.resources.streaming.StreamedQueryResource.handlePushQuery(StreamedQueryResource.java:269)
io.confluent.ksql.rest.server.resources.streaming.StreamedQueryResource.handleStatement(StreamedQueryResource.java:208)
io.confluent.ksql.rest.server.resources.streaming.StreamedQueryResource.streamQuery(StreamedQueryResource.java:161)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
...omitted tens of glassfish and jetty lines...

Additional context

This used to work with v0.6.0.

There's a separate branch local_kafka in the demo repo where the querying works. So the issue seems to be related to the configuration necessary to use Confluent Cloud.

@mmajis mmajis added the bug label Feb 28, 2020
@terryf82
Copy link

terryf82 commented Mar 5, 2020

I also ran into the same issue, but while using ksqlDB 0.7

I'm not sure if it's relevant, but I've only seen it when creating streams that are JSON formatted like the example above. Have not encountered it when using a purely AVRO pipeline.

Use of Confluent Cloud seems to be the common thread.

@yfaykya
Copy link

yfaykya commented Mar 10, 2020

Hi - Is there any work arounds? I don't use the cloud at all. I just spin a container of cp-ksql-server:5.4.1 and then connect with confluentinc/cp-ksql-cli

I can create streams but if I ever try SELECT * FROM my_stream EMIT CHANGES; it gives error as above with the ksql container ID as the host.

@yfaykya
Copy link

yfaykya commented Mar 11, 2020

I sorted it by removing trailing slash from KSQL_LISTENERS.
I was passing in KSQL_LISTENERS=http://0.0.0.0:8088/

@mmajis
Copy link
Author

mmajis commented Mar 11, 2020

Yes, it works without the trailing slash there.

Notably this page has some trailing slashes for KSQL_LISTENERS in the examples: https://github.com/confluentinc/ksql/blob/master/docs-md/operate-and-deploy/installation/install-ksqldb-with-docker.md

@terryf82
Copy link

Confirming that removing the trailing slash also worked here.

@rodesai this was the issue I mentioned via Slack last week. Seems like a documentation bug rather than a technical one.

@mmajis
Copy link
Author

mmajis commented Mar 16, 2020

Since the value for KSQL_LISTENERS looks like a URI I think it'd be good for developer experience that the parsing could handle a trailing slash.

@agavra
Copy link
Contributor

agavra commented Apr 15, 2020

Looks like the fix didn't totally fix the issue - it fixed a similar issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants