akka/akka — pull request #1536 by sirthias (2013-06-14 12:56:33+00:00)
Title: io: tone down error logging a bit more

We are seeing quite bit of error messages like this in our spray-can server logs:

06/14 14:19:03 ERROR[t-dispatcher-29] a.i.TcpIncomingConnection - Connection reset by peer
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method) ~[na:1.6.0_26]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21) ~[na:1.6.0_26]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:202) ~[na:1.6.0_26]
at sun.nio.ch.IOUtil.read(IOUtil.java:169) ~[na:1.6.0_26]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:243) ~[na:1.6.0_26]
at akka.io.TcpConnection.innerRead$1(TcpConnection.scala:198) ~[site.jar:na]
at akka.io.TcpConnection.doRead(TcpConnection.scala:214) ~[site.jar:na]
at akka.io.TcpConnection$$anonfun$connected$1.applyOrElse(TcpConnection.scala:76) ~[site.jar:na]
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:166) ~[site.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) [site.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:386) [site.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) [site.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:212) [site.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [site.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [site.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [site.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [site.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [site.jar:na]

While these entries themselves are certainly helpful the stack traces are not. This patch introduces a new config setting for the TCP side of akka-io enabling the suppression of these stack traces.

(Initially I only wanted to suppress the stack trace for "Connection reset by peer" errors, but since these cannot be easily and reliably distinguished from other IOExceptions this patch treats all IOExceptions the same.)