{"id":6420,"date":"2017-08-04T12:25:03","date_gmt":"2017-08-04T17:25:03","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=6420"},"modified":"2017-08-04T12:25:50","modified_gmt":"2017-08-04T17:25:50","slug":"what-does-web-service-do-when-client-has-socket-timeout-exceeded","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2017\/08\/04\/what-does-web-service-do-when-client-has-socket-timeout-exceeded\/","title":{"rendered":"What does web service do when client has socket timeout exceeded?"},"content":{"rendered":"<p>It should throw a broken pipe exception.  Below shows an strace of a server socket when the client has timed out after not receiving a response in the time period it specified (setTimeout() method)&#8230;<\/p>\n<pre>\r\n13125 12:19:13.666786 <... poll resumed> ) = 1 ([{fd=7, revents=POLLIN}])\r\n13125 12:19:13.666835 accept(7, {sa_family=AF_INET6, sin6_port=htons(21367), inet_pton(AF_INET6, \"::ffff:127.0.0.1\", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 8\r\n13125 12:19:13.666870 fcntl(8, F_GETFL) = 0x2 (flags O_RDWR)\r\n13125 12:19:13.666890 fcntl(8, F_SETFL, O_RDWR) = 0\r\n13125 12:19:13.667242 write(1, \"got socket\", 10) = 10\r\n13125 12:19:13.667500 write(1, \"\\n\", 1) = 1\r\n13125 12:19:13.668865 recvfrom(8, \"s\", 1, 0, NULL, NULL) = 1\r\n13125 12:19:13.694517 recvfrom(8, \"\\n\", 1, 0, NULL, NULL) = 1\r\n13125 12:19:15.695164 sendto(8, \"sending back STEVE\", 18, 0, NULL, 0) = 18\r\n13125 12:19:15.695303 sendto(8, \"\\n\", 1, 0, NULL, 0) = -1 EPIPE (Broken pipe)\r\n13125 12:19:15.695332 --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=13124, si_uid=8084694} ---\r\n13125 12:19:15.695347 rt_sigreturn()    = -1 EPIPE (Broken pipe)\r\n13125 12:19:15.696405 dup2(6, 8)        = 8\r\n13125 12:19:15.696446 close(8)          = 0\r\n13125 12:19:15.696493 poll([{fd=7, events=POLLIN|POLLERR}], 1, 4294967295 <unfinished ...>\r\n<\/pre>\n<p>A similar call from the client has the following system call trace output&#8230;<\/p>\n<pre>\r\n10767 11:52:50.806171 connect(7, {sa_family=AF_INET6, sin6_port=htons(5000), inet_pton(AF_INET6, \"::ffff:127.0.0.1\", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0\r\n10767 11:52:50.806691 getsockname(7,  <unfinished ...>\r\n10767 11:52:50.806912 <... getsockname resumed> {sa_family=AF_INET6, sin6_port=htons(20311), inet_pton(AF_INET6, \"::ffff:127.0.0.1\", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0\r\n10767 11:52:50.807171 write(1, \"0\", 1 <unfinished ...>\r\n10767 11:52:50.807965 write(1, \"\\n\", 1) = 1\r\n10767 11:52:50.808115 write(1, \"1000\", 4) = 4\r\n10767 11:52:50.808180 write(1, \"\\n\", 1) = 1\r\n10767 11:52:50.838359 write(1, \"Fri Aug 04 11:52:50 EDT 2017\", 28) = 28\r\n10767 11:52:50.838496 write(1, \"\\n\", 1) = 1\r\n10767 11:52:50.838600 sendto(7, \"steve\", 5, 0, NULL, 0) = 5\r\n10767 11:52:50.838729 sendto(7, \"\\n\", 1, 0, NULL, 0) = 1\r\n10767 11:52:50.838857 poll([{fd=7, events=POLLIN|POLLERR}], 1, 1000 <unfinished ...>\r\n10767 11:52:51.839950 <... poll resumed> ) = 0 (Timeout)\r\n10767 11:52:51.841524 write(2, \"java.net.SocketTimeoutException: Read timed out\", 47) = 47\r\n<\/pre>\n<p>It should be noted that for the server, even though EPIPE is clearly returned by the OS, java (1.8.0.101) will not <b>necessarily<\/b> raise any exception on this event.  This is bad, as logging clients that have timed out or gone away for any reason can be invaluable when troubleshooting.  I didn&#8217;t dig into the JDK source code, but it would be interesting to see why they ignore this signal.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It should throw a broken pipe exception. Below shows an strace of a server socket when the client has timed out after not receiving a response in the time period it specified (setTimeout() method)&#8230; 13125 12:19:13.666786 ) = 1 ([{fd=7,&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2017\/08\/04\/what-does-web-service-do-when-client-has-socket-timeout-exceeded\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[7,77,56],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6420"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=6420"}],"version-history":[{"count":7,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6420\/revisions"}],"predecessor-version":[{"id":6435,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6420\/revisions\/6435"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=6420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=6420"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=6420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}