[ https://issues.apache.org/jira/browse/GEODE-3555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Galen O'Sullivan updated GEODE-3555: ------------------------------------ Description: If the number of client connections is above the configured maximum, new client connections will be rejected with a message that is meant for old clients and, to them, is unintelligible. This can be seen with the following test added to {{RoundTripCacheConnectionJUnitTest}}: {code} @Test public void testNewProtocolRespectsMaxConnectionLimit() throws IOException, InterruptedException { cache.close(); CacheFactory cacheFactory = new CacheFactory(); Cache cache = cacheFactory.create(); CacheServer cacheServer = cache.addCacheServer(); final int cacheServerPort = AvailablePortHelper.getRandomAvailableTCPPort(); cacheServer.setPort(cacheServerPort); cacheServer.setMaxConnections(16); cacheServer.setMaxThreads(16); cacheServer.start(); AcceptorImpl acceptor = ((CacheServerImpl) cacheServer).getAcceptor(); Socket[] sockets = new Socket[16]; for (int i = 0; i < 16; i++) { Socket socket = new Socket("localhost", cacheServerPort); sockets[i] = socket; Awaitility.await().atMost(5, TimeUnit.SECONDS).until(socket::isConnected); socket.getOutputStream().write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber()); } try (Socket socket = new Socket("localhost", cacheServerPort)) { Awaitility.await().atMost(5, TimeUnit.SECONDS).until(socket::isConnected); OutputStream outputStream = socket.getOutputStream(); outputStream .write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber()); assertEquals(-1, socket.getInputStream().read()); } {code} This can be traced to a call to {{ ServerHandShakeProcessor.refuse(socket.getOutputStream(), ...}} . was: If the number of client connections is above the configured maximum, new client connections will be rejected with a message that is meant for old clients and, to them, is unintelligible. This can be seen with the following test added to {{RoundTripCacheConnectionJUnitTest}}: {code} @Test public void testNewProtocolRespectsMaxConnectionLimit() throws IOException, InterruptedException { cache.close(); CacheFactory cacheFactory = new CacheFactory(); Cache cache = cacheFactory.create(); CacheServer cacheServer = cache.addCacheServer(); final int cacheServerPort = AvailablePortHelper.getRandomAvailableTCPPort(); cacheServer.setPort(cacheServerPort); cacheServer.setMaxConnections(16); cacheServer.setMaxThreads(16); cacheServer.start(); AcceptorImpl acceptor = ((CacheServerImpl) cacheServer).getAcceptor(); Socket[] sockets = new Socket[16]; for (int i = 0; i < 16; i++) { Socket socket = new Socket("localhost", cacheServerPort); sockets[i] = socket; Awaitility.await().atMost(5, TimeUnit.SECONDS).until(socket::isConnected); socket.getOutputStream().write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber()); } try (Socket socket = new Socket("localhost", cacheServerPort)) { Awaitility.await().atMost(5, TimeUnit.SECONDS).until(socket::isConnected); OutputStream outputStream = socket.getOutputStream(); outputStream .write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber()); assertEquals(-1, socket.getInputStream().read()); } {code} This can be traced to a call to {{ ServerHandShakeProcessor.refuse(socket.getOutputStream(), ...}}. > Protobuf clients are rejected with an old-client-specific message. > ------------------------------------------------------------------ > > Key: GEODE-3555 > URL: https://issues.apache.org/jira/browse/GEODE-3555 > Project: Geode > Issue Type: Bug > Components: messaging > Reporter: Galen O'Sullivan > Fix For: 1.3.0 > > > If the number of client connections is above the configured maximum, new > client connections will be rejected with a message that is meant for old > clients and, to them, is unintelligible. > This can be seen with the following test added to > {{RoundTripCacheConnectionJUnitTest}}: > {code} > @Test > public void testNewProtocolRespectsMaxConnectionLimit() > throws IOException, InterruptedException { > cache.close(); > CacheFactory cacheFactory = new CacheFactory(); > Cache cache = cacheFactory.create(); > CacheServer cacheServer = cache.addCacheServer(); > final int cacheServerPort = > AvailablePortHelper.getRandomAvailableTCPPort(); > cacheServer.setPort(cacheServerPort); > cacheServer.setMaxConnections(16); > cacheServer.setMaxThreads(16); > cacheServer.start(); > AcceptorImpl acceptor = ((CacheServerImpl) cacheServer).getAcceptor(); > Socket[] sockets = new Socket[16]; > for (int i = 0; i < 16; i++) { > Socket socket = new Socket("localhost", cacheServerPort); > sockets[i] = socket; > Awaitility.await().atMost(5, > TimeUnit.SECONDS).until(socket::isConnected); > > socket.getOutputStream().write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber()); > } > try (Socket socket = new Socket("localhost", cacheServerPort)) { > Awaitility.await().atMost(5, > TimeUnit.SECONDS).until(socket::isConnected); > OutputStream outputStream = socket.getOutputStream(); > outputStream > > .write(CommunicationMode.ProtobufClientServerProtocol.getModeNumber()); > assertEquals(-1, socket.getInputStream().read()); > } > {code} > This can be traced to a call to {{ > ServerHandShakeProcessor.refuse(socket.getOutputStream(), ...}} > . -- This message was sent by Atlassian JIRA (v6.4.14#64029)