zrhoffman commented on code in PR #7146:
URL: https://github.com/apache/trafficcontrol/pull/7146#discussion_r999684460


##########
traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/dns/protocol/TCP.java:
##########
@@ -112,6 +115,20 @@ public void run() {
                 os.write(response);
             } catch (final WireParseException e) {
                 // This is already recorded in the access log
+            } catch (final SocketTimeoutException e) {
+                String hostAddress = "unknown";
+                if (client != null) {
+                    hostAddress = client.getHostAddress();
+                }
+                LOGGER.error("The socket with the Client at: " +
+                        hostAddress + " has timed out. Error: " + 
e.getMessage(), e);

Review Comment:
   This still prints the stack trace, which we don't need in this specific case.
   
   ```java
   ERROR 2022-10-19T16:17:45.535 [pool-13-thread-1] 
org.apache.traffic_control.traffic_router.core.dns.protocol.TCP - The socket 
with the Client at: 2001:3984:3989:0:0:0:0:3 has timed out. Error: Read timed 
out
   java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method) ~[?:?]
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:115) 
~[?:?]
        at java.net.SocketInputStream.read(SocketInputStream.java:168) ~[?:?]
        at java.net.SocketInputStream.read(SocketInputStream.java:140) ~[?:?]
        at 
java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:388) 
~[?:?]
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65) ~[?:?]
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107) 
~[?:?]
        at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101) 
~[?:?]
        at java.io.DataInputStream.readFully(DataInputStream.java:200) ~[?:?]
        at java.io.DataInputStream.readFully(DataInputStream.java:170) ~[?:?]
        at 
org.apache.traffic_control.traffic_router.core.dns.protocol.TCP$TCPSocketHandler.run(TCP.java:111)
 [classes/:?]
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
[?:?]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
[?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
   ````
   
   In the dev CDN in a Box, ran
   ```shell
   docker-compose exec trafficops wget -O- trafficrouter:53
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to