DataDog / java-dogstatsd-client

Java statsd client library
MIT License
176 stars 102 forks source link

Fix UnixSocketTest#resist_dsd_restart #202

Closed vickenty closed 2 years ago

vickenty commented 2 years ago

Avoid sending too many metrics to a closed socket, to avoid a race condition with the lastException reset.

Occasionally, two metrics will be sent to the client after the server socket was removed. First one triggers an exception and causes the send loop to break. Test case then resets the lastException variable, while the client is still running and has another message buffered. If that is delivered before the server is started, it triggers another exception and causes nullValue() check to fail and the end of the test case.