一個關於java.net.Socket的超時的問題

火星人 @ 2014-03-09 , reply:0
←手機掃碼閱讀

  從異常信息中,可以看到是read timed out,應該是Socket在讀取Post過來的參數時「後繼無人」,造成讀取超時.因為底層實現是java.net.Socket

  ,而在Socket的read過程中SO_TIMEOUT參數是設置讀取超時的.從這方面入手,提出以下幾點建議供參考:

  1.啟用native i/o

  2.增加Socket Readers,這是一個百分比,默認是33,從1-99,增加這個參數可以提高服務端接收客戶端請求的速度和能力.

  3.增加執行隊列.

  以上參數在server- >Configuration- >tuning中可以設置.

  注意:以上參數調整先從測試環境中以近似壓力測試後有效再應用於生產環境.

  ======= 2007-07-06 09:28:22 您在來信中寫道:=======

  >各位老師,您好:

  >

  > 昨天中午到下午4點,醫院端應用dump了3次,去年11月份二期切換的時候也頻繁dump,最近有愈加頻繁的趨勢.

  >

  > 以下是現場發回的控制台日至,煩請各位老師幫助分析原因,謝謝!

  >

  >#### <2007-7-5 20時05分29秒 GMT 08:00 > <Error > <HTTP > <loopback > <his_managedServer1 > <ExecuteThread: '2' for queue:

  'weblogic.kernel.Default' > < <WLS Kernel > > < > <BEA-101017 > <[ServletContext(id=1681284293,name=his,context-path=/his)] Root cause

  of ServletException.

  >java.net.SocketTimeoutException: Read timed out

  > at java.net.SocketInputStream.socketRead0(Native Method)

  > at java.net.SocketInputStream.read(SocketInputStream.java(Compiled Code))

  > at weblogic.servlet.internal.PostInputStream.read(PostInputStream.java(Compiled Code))

  > at weblogic.servlet.internal.ServletInputStreamImpl.read(ServletInputStreamImpl.java(Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(ServletRequestImpl.java(Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(ServletRequestImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequestImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequestImpl.java(Compiled Code))

  > at com.neusoft.unieap.util.RequestUtil. <init >(RequestUtil.java(Inlined Compiled Code))

  > at com.neusoft.unieap.action.EAPDispatchAction.execute(EAPDispatchAction.java(Compiled Code))

  > at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java(Inlined Compiled Code))

  > at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java(Compiled Code))

  > at com.neusoft.unieap.action.EAPActionServlet.process(EAPActionServlet.java(Compiled Code))

  > at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java(Compiled Code))

  > at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))

  > at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))

  > at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled Code))

  > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java(Compiled Code))

  > at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java(Compiled Code))

  > at weblogic.security.service.SecurityManager.runAs(SecurityManager.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java(Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java(Compiled Code))

  > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java(Compiled Code))

  > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java(Compiled Code))

  >--------------- nested within: ------------------

  >weblogic.utils.NestedRuntimeException: Cannot parse POST parameters of request: '/his/DrugChargeAction.do' - with nested

  exception:

  >[java.net.SocketTimeoutException: Read timed out]

  > at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(ServletRequestImpl.java(Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(ServletRequestImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequestImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequestImpl.java(Compiled Code))

  > at com.neusoft.unieap.util.RequestUtil. <init >(RequestUtil.java(Inlined Compiled Code))

  > at com.neusoft.unieap.action.EAPDispatchAction.execute(EAPDispatchAction.java(Compiled Code))

  > at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java(Inlined Compiled Code))

  > at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java(Compiled Code))

  > at com.neusoft.unieap.action.EAPActionServlet.process(EAPActionServlet.java(Compiled Code))

  > at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java(Compiled Code))

  > at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))

  > at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))

  > at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled Code))

  > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java(Compiled Code))

  > at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java(Compiled Code))

  > at weblogic.security.service.SecurityManager.runAs(SecurityManager.java(Inlined Compiled Code))

  > at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java(Compiled Code))

  > at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java(Compiled Code))

  > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java(Compiled Code))

  > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java(Compiled Code))





[火星人 via ] 一個關於java.net.Socket的超時的問題已經有879次圍觀

http://www.coctec.com/docs/java/show-post-60902.html