From 6860564d71f827364faf5eb483e1169c84a9a9f8 Mon Sep 17 00:00:00 2001 From: Vikentiy Fesunov Date: Mon, 18 Mar 2024 19:24:47 +0100 Subject: [PATCH 1/2] Improve robustness of stream socket tests Make the test more robust by waiting for the expected error state to be reached. "broken pipe" is the initial error sender gets when trying to write to the disconnected socket, but it can not be reliably observed due to lack of synchronization between the sender thread and the test body. --- .../com/timgroup/statsd/UnixStreamSocketTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/timgroup/statsd/UnixStreamSocketTest.java b/src/test/java/com/timgroup/statsd/UnixStreamSocketTest.java index 45af036c..b5515069 100644 --- a/src/test/java/com/timgroup/statsd/UnixStreamSocketTest.java +++ b/src/test/java/com/timgroup/statsd/UnixStreamSocketTest.java @@ -34,6 +34,11 @@ public synchronized void handle(Exception exception) { lastException = exception; } + synchronized boolean lastExceptionMessageContains(String s) { + String msg = lastException.getMessage(); + return msg != null && msg.contains(s); + } + @BeforeClass public static void supportedOnly() throws IOException { Assume.assumeTrue(TestHelpers.isUdsAvailable()); @@ -108,22 +113,19 @@ public void resist_dsd_restart() throws Exception { // Close the server, client should throw an IOException server.close(); - while(lastException.getMessage() == null) { + while(!lastExceptionMessageContains("Connection refused")) { client.gauge("mycount", 20); Thread.sleep(10); } - // Depending on the state of the client at that point we might get different messages. - assertThat(lastException.getMessage(), anyOf(containsString("Connection refused"), containsString("Broken pipe"))); // Delete the socket file, client should throw an IOException lastException = new Exception(); socketFile.delete(); client.gauge("mycount", 21); - while(lastException.getMessage() == null) { + while(!lastExceptionMessageContains("No such file or directory")) { Thread.sleep(10); } - assertThat(lastException.getMessage(), containsString("No such file or directory")); // Re-open the server, next send should work OK DummyStatsDServer server2; From 30fe2a9c13f93d5374ff2fea4bf1c6cd7686013b Mon Sep 17 00:00:00 2001 From: Vikentiy Fesunov Date: Fri, 4 Oct 2024 14:13:01 +0000 Subject: [PATCH 2/2] [release] prepare v4.4.3 --- CHANGELOG.md | 5 +++++ README.md | 2 +- pom.xml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ead70b7c..2494d6fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 4.4.3 / 2024.10.04 + +* [BUGFIX] Use correct buffer size for unix sockets. See [#256][] + ## 4.4.2 / 2024.06.03 * [BUGFIX] Fix sampling and visibility issues with new direct client. See [#249][] @@ -254,6 +258,7 @@ Fork from [indeedeng/java-dogstatsd-client] (https://github.com/indeedeng/java-d [#243]: https://github.com/DataDog/java-dogstatsd-client/issues/243 [#247]: https://github.com/DataDog/java-dogstatsd-client/issues/247 [#249]: https://github.com/DataDog/java-dogstatsd-client/issues/249 +[#256]: https://github.com/DataDog/java-dogstatsd-client/issues/256 [@PatrickAuld]: https://github.com/PatrickAuld diff --git a/README.md b/README.md index 97dd394e..c1dc1196 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The client jar is distributed via Maven central, and can be downloaded [from Mav com.datadoghq java-dogstatsd-client - 4.4.2 + 4.4.3 ``` diff --git a/pom.xml b/pom.xml index 0cbb3e92..c816a348 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ java-dogstatsd-client jar java-dogstatsd-client - 4.4.2 + 4.4.3 A tiny library allowing Java applications to communicate with DataDog statsd instances easily. https://github.com/DataDog/java-dogstatsd-client