fix(elasticache): resolve order-dependent crossGroupAuthIsRejected test failure (#1991) (#3074)

* fix(elasticache): fix order-dependent crossGroupAuthIsRejected failure and handle proxy socket closing cleanly

* fix(elasticache): address review feedback on socket cleanup logging and test isolation

* fix(elasticache): use JBoss Logger and verify cleanup status in integration test
This commit is contained in:
Vũ Thế Huy authored and GitHub committed 2026-09-05 14:04:43 -04:00
1 parent 37faaa8abe
commit 173ff45b12
3 files changed
+73 -31

No files matched your search

@@ -248,11 +248,13 @@ public class ElastiCacheService implements ResourceProvider {
: 1);
applyCommonAttributes(group, request, resolvedSettings);
proxyManager.startProxy(groupId, authMode, proxyPort,
handle.getHost(), handle.getPort(),
(username, password) -> validatePassword(groupId, username, password));
synchronized (lockFor("rg:" + groupId)) {
groups.put(groupId, group);
proxyManager.startProxy(groupId, authMode, proxyPort,
handle.getHost(), handle.getPort(),
(username, password) -> validatePassword(groupId, username, password));
}
groups.put(groupId, group);
LOG.infov("Replication group {0} created, endpoint={1}:{2}", groupId, endpointHost, String.valueOf(proxyPort));
return group;
} catch (RuntimeException e) {
@@ -615,6 +617,7 @@ public class ElastiCacheService implements ResourceProvider {
} catch (RuntimeException e) {
LOG.warnv("Error stopping container for replication group {0}: {1}", groupId, e.getMessage());
} finally {
groups.delete(groupId);
releaseProxyPort(proxyPort);
}
}
@@ -212,8 +212,19 @@ public class ElastiCacheAuthProxy {
out.flush();
}
private static void closeQuietly(Socket s) {
try { s.close(); } catch (IOException ignored) {}
private void closeQuietly(Socket s) {
try {
if (!s.isClosed()) {
try {
s.shutdownOutput();
} catch (IOException e) {
LOG.debugv(e, "Error shutting down socket output for group {0}", groupId);
}
s.close();
}
} catch (IOException e) {
LOG.debugv(e, "Error closing socket for group {0}", groupId);
}
}
/**