You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/10/12 06:03:49 UTC

[GitHub] [servicecomb-java-chassis] five111 opened a new issue #2606: 接口抛出异常408,原因是线程处于中断状态

five111 opened a new issue #2606:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2606


   接口调用时异常日志如下:
   ```
   org.apache.servicecomb.swagger.invocation.exception.InvocationException: InvocationException: code=408;msg=CommonExceptionData{code='SCB.00000004', message='Invocation Timeout.', dynamic={}}
   	at org.apache.servicecomb.core.provider.consumer.SyncResponseExecutor.guardedWait(SyncResponseExecutor.java:85) ~[java-chassis-core-2.1.5-h0.gts.dsp.r17.jar:2.1.5-h0.gts.dsp.r17]
   	at org.apache.servicecomb.core.provider.consumer.SyncResponseExecutor.waitResponse(SyncResponseExecutor.java:54) ~[java-chassis-core-2.1.5-h0.gts.dsp.r17.jar:2.1.5-h0.gts.dsp.r17]
   	at org.apache.servicecomb.core.provider.consumer.InvokerUtils.innerSyncInvoke(InvokerUtils.java:160) [java-chassis-core-2.1.5-h0.gts.dsp.r17.jar:2.1.5-h0.gts.dsp.r17]
   	at org.apache.servicecomb.provider.pojo.HandlerInvocationCaller.syncInvoke(HandlerInvocationCaller.java:40) [provider-pojo-2.1.5-h0.gts.dsp.r17.jar:2.1.5-h0.gts.dsp.r17]
   	at org.apache.servicecomb.provider.pojo.HandlerInvocationCaller.call(HandlerInvocationCaller.java:34) [provider-pojo-2.1.5-h0.gts.dsp.r17.jar:2.1.5-h0.gts.dsp.r17]
   	at org.apache.servicecomb.provider.pojo.Invoker.invoke(Invoker.java:71) [provider-pojo-2.1.5-h0.gts.dsp.r17.jar:2.1.5-h0.gts.dsp.r17]
   	at com.sun.proxy.$Proxy343.queryTaskResult(Unknown Source) [?:?]
   	at com.huawei.mateinfo.io.thread.install.rpc.taskquery.ItemInstallTaskQueryRunnable.getResult(ItemInstallTaskQueryRunnable.java:68) [mateinfo-app-mgt-io-1.0.0.jar:?]
   	at com.huawei.mateinfo.io.thread.install.rpc.taskquery.BaseItemTaskQueryRunnable.execute(BaseItemTaskQueryRunnable.java:69) [mateinfo-app-mgt-io-1.0.0.jar:?]
   	at com.huawei.mateinfo.io.thread.install.rpc.taskquery.BaseItemTaskQueryRunnable.run(BaseItemTaskQueryRunnable.java:45) [mateinfo-app-mgt-io-1.0.0.jar:?]
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_292]
   	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_292]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_292]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_292]
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_292]
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_292]
   	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
   ```
   跟踪源码发现异常来源于此方法
   ```
    private void guardedWait(Invocation invocation) throws InvocationException {
       long wait = getWaitTime(invocation);
       try {
         if (wait <= 0) {
           latch.await();
           return;
         }
         if (latch.await(wait, TimeUnit.MILLISECONDS)) {
           return;
         }
       } catch (InterruptedException e) {
         //ignore
       }
       throw new InvocationException(REQUEST_TIMEOUT, ExceptionCodes.INVOCATION_TIMEOUT, "Invocation Timeout.");
     }
   ```
   latch.wait时,线程处于中断状态,导致抛出异常,请问这种问题该如何排查


-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] five111 commented on issue #2606: 接口抛出异常408,原因是线程处于中断状态

Posted by GitBox <gi...@apache.org>.
five111 commented on issue #2606:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2606#issuecomment-940707549


   已找到原因


-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] five111 edited a comment on issue #2606: 接口抛出异常408,原因是线程处于中断状态

Posted by GitBox <gi...@apache.org>.
five111 edited a comment on issue #2606:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2606#issuecomment-940707549


   已找到原因 自身业务代码原因
   问题其实很低级
   业务代码里有个异步的方法,为这个异步的方法设置了个超时时间,超过这个超时时间就会主动中断任务。这个时间在某次合入之后被修改的特别小,就出现了上文的问题。
   
   InterruptedException 其实是非常罕见的,遇到这个问题可以主动考虑是否是主动设置的状态。


-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] five111 edited a comment on issue #2606: 接口抛出异常408,原因是线程处于中断状态

Posted by GitBox <gi...@apache.org>.
five111 edited a comment on issue #2606:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2606#issuecomment-940707549


   已找到原因 自身业务代码原因


-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] five111 closed issue #2606: 接口抛出异常408,原因是线程处于中断状态

Posted by GitBox <gi...@apache.org>.
five111 closed issue #2606:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2606


   


-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] five111 edited a comment on issue #2606: 接口抛出异常408,原因是线程处于中断状态

Posted by GitBox <gi...@apache.org>.
five111 edited a comment on issue #2606:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2606#issuecomment-940707549


   已找到原因 自身业务代码原因
   问题其实很低级
   业务代码里有个异步的方法,为这个异步的方法设置了个超时时间,超过这个超时时间就会主动中断任务。这个时间在某次合入之后被修改的特别小,就出现了上文的问题。
   
   ### 总结一点
   InterruptedException 其实是非常罕见的,遇到这个问题可以优先考虑是否是主动设置的状态。


-- 
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: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org