SimpleLogSink shouldn't perform DNS lookups #39

osi opened this Issue Oct 10, 2011 · 3 comments


None yet

2 participants

osi commented Oct 10, 2011

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.

KushalP commented Oct 10, 2011

@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.

osi commented Oct 10, 2011

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

KushalP commented Oct 10, 2011

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 added a commit that closed this issue Oct 10, 2011
@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 Oct 10, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment