Jetty服务器9.4.10-超时异常-空闲超时已过期

时间:2018-07-20 16:01:32

标签: java dropwizard jetty-9

我正在通过dropwizard 1.2.6使用码头服务器9.4.10。我看到了与如下所示的空闲超时相关的异常

ERROR [2018-07-20 07:51:46,726] [U:224,F:832,T:1,056,M:1,820] vnera.restapilayer.CustomerResource:[ManagementResource:uploadBundle:2434] - [dw-103 - POST /management/upgrade/uploadbundle] - Error occurred during file handling..
java.io.IOException: java.util.concurrent.TimeoutException: Idle timeout expired: 30000/30000 ms
        at org.eclipse.jetty.server.HttpInput$ErrorState.noContent(HttpInput.java:1075)
        at org.eclipse.jetty.server.HttpInput.read(HttpInput.java:313)
        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:999)
        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:903)
        at java.io.InputStream.read(InputStream.java:101)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1488)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1465)
        at com.vnera.restapilayer.ManagementResource.flushFileToDisk(ManagementResource.java:2538)
        at com.vnera.restapilayer.ManagementResource.storeFileToDisk(ManagementResource.java:2464)
        at com.vnera.restapilayer.ManagementResource.uploadBundle(ManagementResource.java:2389)
        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 org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
        at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
        at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:34)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
        at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:45)
        at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:39)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
        at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:311)
        at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:265)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
        at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
        at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
        at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
        at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)

我尝试增加空闲超时时间,但是仍然出现如下相同的错误

ERROR [2018-07-20 14:09:44,970] [U:393,F:687,T:1,080,M:1,820] vnera.restapilayer.CustomerResource:[ManagementResource:uploadBundle:2434] - [dw-157 - POST /management/upgrade/uploadbundle] - Error occurred during file handling..
java.io.IOException: java.util.concurrent.TimeoutException: Idle timeout expired: 1200000/1200000 ms

有人可以让我知道此异常表示什么吗?如何避免这种情况?

这似乎是here中讨论的码头服务器中的一个问题。

1 个答案:

答案 0 :(得分:0)

该问题已在jetty mailing list中进行了讨论。这个建议解决了我的问题

  

首先,不要使用commons-fileupload,它用于Servlet 2.4(以及   较旧)的环境。支持多部分/表单数据解析   作为HttpServletRequest.getParts()进入Servlet规范,并且   自Servlet 3.0以来的getPart(name)   请参阅:https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html#getPart-java.lang.String-

删除commons-fileupload的用法为我解决了这个问题。