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

Missing connection with endpoint fallback in cluster connection #415

Open
jabolina opened this issue Oct 31, 2023 · 2 comments
Open

Missing connection with endpoint fallback in cluster connection #415

jabolina opened this issue Oct 31, 2023 · 2 comments
Labels
Milestone

Comments

@jabolina
Copy link

Version

4.4.4

Context

This seems a corner-case, and likely people won't usually hit. By falling back to the endpoints given during configuration if a slot is not found:

// if we haven't got config for this slot, try any connection
if (endpoints == null || endpoints.length == 0) {
return connectOptions.getEndpoint();
}

The URI might contain some query parameters which cause the command to fail on:

final PooledRedisConnection connection = connections.get(endpoint);
if (connection == null) {
handler.handle(Future.failedFuture("Missing connection to: " + endpoint));
return;
}

More concretely, after executing the CLUSTER SLOTS command, the connections map to the endpoints returned, which has the format rediss://127.0.0.1:11222 (with SSL).

synchronized (connections) {
connections.put(endpoint, cconn);
}

If (for some unusual) reason the slot is not found, falling back to the configured endpoint might not be reliable, as the URI is not necessarily the same, e.g., rediss://127.0.0.1:11222?verifyPeer=NONE. Searching the connections map returns null for the endpoint.

Do you have a reproducer?

I am unsure of other ways to fall back to the configuration URI. So, sadly, I don't have a reproducer for this one. I believe this is really unlikely to happen, but I thought it might be worth reporting it.

@jabolina jabolina added the bug label Oct 31, 2023
@tsegismont tsegismont added this to the 4.5.0 milestone Nov 3, 2023
@tsegismont
Copy link
Contributor

@Ladicek would you mind taking care of this one?

@vietj vietj modified the milestones: 4.5.0, 4.5.1 Nov 15, 2023
@vietj vietj modified the milestones: 4.5.1, 4.5.2 Dec 13, 2023
@vietj vietj modified the milestones: 4.5.2, 4.5.3 Jan 30, 2024
@vietj vietj modified the milestones: 4.5.3, 4.5.4 Feb 6, 2024
@vietj vietj modified the milestones: 4.5.4, 4.5.5 Feb 22, 2024
@vietj vietj modified the milestones: 4.5.5, 4.5.6 Mar 14, 2024
@Ladicek
Copy link
Contributor

Ladicek commented Mar 20, 2024

Just for the record, I didn't forget about this. This is basically about canonicalizing the key to the connection pool map. I'd like to improve the code related to connection pooling more thoroughly [1], and will address this at that point.

[1] For example, there are some validations for connection pool configuration that assume we have a single connection pool, which we don't. We have one connection pool for each connection string. There's also this issue, which I think we should address.

@vietj vietj modified the milestones: 4.5.6, 4.5.7, 4.5.8 Mar 21, 2024
@vietj vietj modified the milestones: 4.5.8, 4.5.9 May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants