Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


SimpleLogSink shouldn't perform DNS lookups #39

osi opened this Issue · 3 comments

2 participants


SimpleLogSink performs a DNS when formatting log entries.

If the examples are following, using a LogginHandler with a SimpleLogSink, all of a sudden there's a blocking DNS request occurring on the main I/O thread.

By default, SimpleLogSink should not perform DNS resolution when logging remote addresses.


@osi just for context, are you referring to this: ?

A hacky way around it could be to launch a separate thread which calls getHostName() and then returns the value it finds (or doesn't after timeout). The problem with this ends up being the wait time, which will affect how logs are ordered if there is any significant delay.

I'm not a networking expert, so I'm open to hearing/learning about better alternatives to this.


it should just return address.toString() always. logs can be post-processed for DNS resolution later.


I guess as SocketAddress is an abstract class it's safe to assume we'll be getting some sub-class of it.

Putting in a change now.

@KushalP KushalP closed this issue from a commit
@KushalP KushalP Stop blocking SimpleLogSink with InetSocketAddress.getHostName(). Clo…
…ses #39.

Rather than casting (if instance of InetSocketAddress) directly give back SocketAddress.toString() rather than blocking. This way the casting can be handled in post-processing of logs. An alternative would be to ship this off to another thread, but then logs wouldn't be deterministic.
@KushalP KushalP closed this in b17cb8f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.