zoukankan      html  css  js  c++  java
  • JSch com.jcraft.jsch.Session sftp连接超时时间timeout默认设置0 导致一直处于等待连接状态

    线上排查发现一个定时任务task(原来每隔1小时跑一次的),5.7号只跑了一次,根据日志排查发现,打印了开始的日志,到连接sftp时,下面没有日志了

    查看jvm堆栈信息:

    jstack -l pid >jstack.log (pid进程id)

    jstack -l 63522 >63522-jstack.log

    scheduler_Worker-25(日志里看到也是这个线程)

    "scheduler_Worker-25" #38 prio=5 os_prio=0 tid=0x00007f0248e4a000 nid=0xf888 runnable [0x00007f0200fcb000]
       java.lang.Thread.State: RUNNABLE
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
            at java.net.SocketInputStream.read(SocketInputStream.java:171)
            at java.net.SocketInputStream.read(SocketInputStream.java:141)
            at java.net.SocketInputStream.read(SocketInputStream.java:224)
            at com.jcraft.jsch.IO.getByte(IO.java:73)
            at com.jcraft.jsch.Session.connect(Session.java:263)
            at com.jcraft.jsch.Session.connect(Session.java:183)
            at com.cmcc.open.ss.util.CommonSftpUtil.getSftpConnect(CommonSftpUtil.java:85)
            at com.cmcc.open.task.service.PhoneAscriptionQueryTask.downloadAndBak(PhoneAscriptionQueryTask.java:190)
            at com.cmcc.open.task.service.PhoneAscriptionQueryTask.getHoursPhoneNum(PhoneAscriptionQueryTask.java:159)
            at com.cmcc.open.task.service.PhoneAscriptionQueryTask$$FastClassBySpringCGLIB$$fc62f4f8.invoke(<generated>)
            at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
            at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:737)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
            at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
            at com.cmcc.open.task.aop.TaskAspect.taskAspectMethod(TaskAspect.java:67)
            at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
            at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
            at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
            at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
            at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:672)
            at com.cmcc.open.task.service.PhoneAscriptionQueryTask$$EnhancerBySpringCGLIB$$24b5bb1a.getHoursPhoneNum(<generated>)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at com.cmcc.open.task.utils.MyDetailQuartzJobBean.executeInternal(MyDetailQuartzJobBean.java:50)
            at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
            at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
            at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
            - locked <0x00000006d21b37b8> (a java.lang.Object)

       Locked ownable synchronizers:
            - None

    最后定位,是没有设置connectTimeout参数,默认是0,导致一直处于等待连接的状态,卡了好几天,导致task都没运行。

  • 相关阅读:
    《1024伐木累》-小白篇之月侠-总章节五
    《1024伐木累-周末特别篇》-中彩票了,开发APP
    《1024伐木累》-有话直说,蛋疼~
    《1024伐木累》- 老王请客吃晚饭,介绍对象
    《1024伐木累》-小白篇之丽姐(前篇)-总章节四
    程序员最值得听的歌曲TOP10
    《1024伐木累》-职位不分贵贱,没房子怎么乐
    偶是一只别人眼里的程序猿
    《1024伐木累》-写代码写的娘炮了
    《1024伐木累》-小白篇之加班(结束篇)-总章节三
  • 原文地址:https://www.cnblogs.com/wuyun-blog/p/14767451.html
Copyright © 2011-2022 走看看