diff --git a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java index c3aa31950..70199e6ce 100644 --- a/src/main/java/net/openhft/chronicle/map/TcpReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/TcpReplicator.java @@ -1818,12 +1818,16 @@ class StatelessServerConnector { @Nullable private Work sendException(@NotNull TcpReplicator.TcpSocketChannelEntryWriter writer, long sizeLocation, @NotNull Throwable e) { + + LOG.error("cause by remote stateless client call", e); + // move the position to ignore any bytes written so far writer.in().position(sizeLocation + HEADER_SIZE); writeException(writer, e); - writeSizeAndFlags(sizeLocation + SIZE_OF_TRANSACTION_ID, true, writer.in()); + writeSizeAndFlags(sizeLocation, true, writer.in()); + return null; } diff --git a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java index 84bea0da7..47fd1d30f 100644 --- a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java +++ b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java @@ -26,7 +26,6 @@ import net.openhft.lang.io.ByteBufferBytes; import net.openhft.lang.io.Bytes; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -208,6 +207,32 @@ public class StatelessClientTest { } + @Test(timeout = 10000) + public void testLotsOfPuts() throws IOException, InterruptedException { + int port = s_port++; + + final int size = 10000; + + try (ChronicleMap serverMap = ChronicleMapBuilder + .of(Integer.class, CharSequence.class) + .entries(100) + .replication((byte) 2, TcpTransportAndNetworkConfig.of(port)) + .create()) { + try (ChronicleMap statelessMap = localClient(port)) { + + + for (int i = 0; i < size; i++) { + statelessMap.put(i, "hello"); + } + + assertEquals(statelessMap.size(), size); + + } + } + } + + + @Test public void testBufferOverFlowPutAllAndKeySet() throws IOException, InterruptedException { int port = 10 + s_port++;