question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quarkus Redis client not accepting hostnames with underscores in it

See original GitHub issue

Describe the bug

This is a borderline bug, since, depending on where on the Internet you check, underscores are either not recommended or not allowed in hostnames.

The issue I am having is that I am running a Quarkus App in one Docker Swarm stack, which needs to connect to a Redis server in another stack. In the Docker Swarm world, with the service redis running in the stack redis, that means that my config would have to be

quarkus.redis.hosts=redis://redis_redis:6379

However, in io.quarkus.redis.client.runtime.RedisConfig.RedisConfiguration, the hosts are defined as a set of URIs

        @ConfigItem(
            defaultValueDocumentation = "redis://localhost:6379"
        )
        public Optional<Set<URI>> hosts;

and java.net.URI does not accept hostnames with underscores in them.

Expected behavior

The Redis client uses the Redis host name with underscores in it as defined in application.properties

Actual behavior

The Redis client defaults to using redis://localhost:6379

To Reproduce

Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).

Or attach an archive containing the reproducer to the issue.

Steps to reproduce the behavior:

  1. Start from the Redis quickstart, https://github.com/quarkusio/quarkus-quickstarts/tree/main/redis-quickstart
  2. Update application.properties with quarkus.redis.hosts=redis://redis_redis:6379
  3. Run application, it will connect to the default Redis hostname redis://localhost:6379

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gsmetcommented, Apr 1, 2021

I don’t think we can reasonably do something about this. Closing.

1reaction
magnusvagecommented, Mar 29, 2021

I think this is an issue of RFC/specs vs. reality. Agreed, the specs say no to underscores, but in reality it has become somewhat prevalent (but one could argue it is a bad design choice on the Docker Swarm side to generate hostnames like this).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quarkus Redis client not using host from application.properties
UPDATE: The issue is most likely due to the underscores in my hostname, and the fact that the Quarkus Redis client internally uses...
Read more >
Using the Redis Client - Quarkus
This guide demonstrates how your Quarkus application can connect to a Redis server using the Redis Client extension. This technology is considered preview....
Read more >
Quarkus - Jerome Boyer's Personal Site
Quarkus CLI lets you create projects, manage extensions and do essential build and dev commands using the underlying project's build tool. It replaces...
Read more >
Java qpid-client ignores hostnames containing underscores
Result: If the hostname contains an underscore, the client now connects to the ... ConnectException: Connection refused (assuming no qpidd running on ...
Read more >
debezium/user - Gitter
@dvfeinblum No dice, underscore didn't change the behavior either. ... I'm having trouble with the tradeoff between getting connection errors with postgres ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found