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

After 4.2.0 migration, using ioredis, you must force IPv6 resolution for the streaming API #27043

Open
AlyxPractice opened this issue Sep 21, 2023 · 4 comments
Labels
bug Something isn't working status/identified This bug has been identified streaming Streaming server

Comments

@AlyxPractice
Copy link

AlyxPractice commented Sep 21, 2023

Steps to reproduce the problem

Following the migration to ioredis (#26581) I had connection issues to my Redis instance on fly.io, using IPv6.

I was using :

REDIS_HOST = "my-instance-redis.internal"
REDIS_PORT = "6379"

But now I need to force the IPv6 resolution using the family parameter :

REDIS_URL = "redis://my-instance-redis.internal:6379/?family=6"

I found some occurrences of this parameter here and there:

Maybe we could add a warning to the administrator in the changelog about that? Ideally, a way to resolve the hostname, no matter if it's IPv4 or IPv6 on top of their library would be super cool to avoid any issues like this.

I'm creating this issue to help others mostly if they spot something similar.

Expected behaviour

ioredis library should do the hostname IPv6 resolution "natively"

Actual behaviour

ioredis failed to connect to IPv6 Redis instances, except if you force it using the family parameter in REDIS_URL

Detailed description

No response

Mastodon instance

3615.computer

Mastodon version

v4.2.0

Technical details

If this is happening on your own Mastodon server, please fill out those:

  • Ruby version: v3.2.2p53
  • Node.js version: v20.6.1

I did not save the log showing the issue, but from my search history it was something like Error: getaddrinfo ENOTFOUND.

@AlyxPractice AlyxPractice added bug Something isn't working status/to triage This issue needs to be triaged labels Sep 21, 2023
@vmstan
Copy link
Sponsor Contributor

vmstan commented Sep 21, 2023

Does this impact the regular Mastodon process connections to Redis as well or just for the streaming API?

@AlyxPractice
Copy link
Author

Does this impact the regular Mastodon process connections to Redis as well or just for the streaming API?

Sidekiq was in a working state so it seems to only impact the streaming API.

@AlyxPractice
Copy link
Author

I'll try to write some code to easily reproduce the issue and eventually make a PR here or on ioredis. ioredis seems to use https://nodejs.org/api/dns.html#dnslookuphostname-options-callback under the hood.

rgrove added a commit to rgrove/pie.gd that referenced this issue Sep 23, 2023
@ThisIsMissEm
Copy link
Contributor

@VictorBersy I think you'd be better filing this as an upstream issue in ioredis: https://github.com/redis/ioredis/issues

By default ioredis assumes IPv4, per https://github.com/redis/ioredis/blob/main/lib/redis/RedisOptions.ts#L192, when it should probably not assume IPv4 (by passing 0 for the family instead of 4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status/identified This bug has been identified streaming Streaming server
Projects
None yet
Development

No branches or pull requests

4 participants