我有一个用Java编写的服务器,在Tomcat下运行Spring MVC(Spring BOOT)。我们注意到一些客户机正在发送一个POST请求,该请求具有一个内容长度头,但没有实体体。当这个请求进入时,请求挂起20秒,然后一个响应(400)从服务器返回。
“http-nio-31114-exec-4”#52守护进程prio=5操作系统prio=31 tid=0x00007fc26e6b6000 nid=0x9f03等待条件[0x00007000010a1f000]
java.lang.Thread.State:定时等待(停车)
-等待停车(java.util.concurrent.countdownlock$Sync)
在java.util.concurrent.locks.LockSupport.parkNanos上(LockSupport.java:215)
在java.util.concurrent.locks.AbstractQueuedSynchronizer.tryacquireSharedNano上(AbstractQueuedSynchronizer.java:1328)
在org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.awaitLatch(NioEndpoint.java:1106)
在org.apache.tomcat.util.net.NioBlockingSelector.read上(NioBlockingSelector.java:184)
在org.apache.tomcat.util.net.NioSelectorPool.read上(NioSelectorPool.java:235)
在org.apache.tomcat.util.net.NioSelectorPool.read上(NioSelectorPool.java:216)
在org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1182)
在org.apache.coyote.http11.Http11InputBuffer.access$300(Http11InputBuffer.java:40)
在org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:140)
在org.apache.coyote.Request.doRead(Request.java:541)
在org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:634)
在org.apache.catalina.connector.InputBuffer.readByte(InputBuffer.java:337)
点击org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:93)
在java.io.PushbackInputStream.read上(PushbackInputStream.java:139)
位于org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver$EmptyBodyCheckingHttpInputMessage。(AbstractMessageConverterMethodArgumentResolver.java:319)
位于org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverterMethodArgumentResolver.java:192)
在org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:130)
在org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124)
位于org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161)
在org.springframework.web.method.support.InvocableHandlerMethod.invokeForeQuest(InvocableHandlerMethod.java:131)
在org.springframework.web.servlet.mvc.method.annotation.servletinvrablehandlermethod.invokeAndHandle(servletinvrablehandlermethod.java:102)
在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
在org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
在org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
在org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
在org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
在javax.servlet.http.HttpServlet.service上(HttpServlet.java:707)
在javax.servlet.http.HttpServlet.service上(HttpServlet.java:790)
位于org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
在org.springframework.web.filter.RequestContextFilter.doFilternal(RequestContextFilter.java:99)
位于org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
位于org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
位于org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
位于org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
位于org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:48)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
位于org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
位于org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
在org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
位于org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
在org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在org.springframework.web.filter.CharacterEncodingFilter.doFilternal(CharacterEncodingFilter.java:200)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
在org.apache.catalina.core.StandardWrapperValve.invoke上(StandardWrapperValve.java:198)
在org.apache.catalina.core.StandardContextValve.invoke上(StandardContextValve.java:96)
在org.apache.catalina.core.StandardHostValve.invoke上(StandardHostValve.java:140)
在org.apache.catalina.valves.ErrorReportValve.invoke上(ErrorReportValve.java:80)
在org.apache.catalina.core.StandardEngineValve.invoke上(StandardEngineValve.java:87)
在com.fabrikam.valve.RequestTraceValve$$Lambda$423/855335917.accept(未知来源)
在com.fabrikam.valve.RequestTraceValve.invoke上(RequestTraceValve.java:39)
在org.apache.coyote.http11.Http11Processor.service上(Http11Processor.java:799)
在org.apache.coyote.AbstractProcessorLight.process上(AbstractProcessorLight.java:66)
在org.apache.coyote.AbstractProtocol$ConnectionHandler.process上(AbstractProtocol.java:861)
在org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
-锁定(org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper)
在java.util.concurrent.ThreadPoolExecutor.runWorker上(ThreadPoolExecutor.java:1142)
在java.util.concurrent.ThreadPoolExecutor$Worker.run上(ThreadPoolExecutor.java:617)
在org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
运行(Thread.java:745)
servlet如下所示:
@RequestMapping(路径=“/event/{apikey}/{anonymousId}”,方法=RequestMethod.POST,products=”应用程序/json“)
公共void clickRawPost(
@路径变量字符串apikey,
@RequestBody(required=false)字符串后置内容,
HttpServletResponse响应)
抛出IOException{
repro命令如下:
$时间卷曲-s
http://localhost:8080/event/test/foo
-H'内容类型:
应用程序/json'-H'内容长度:100'-X POST-v
这个命令20秒后就失效了。
我原以为它会很快失败,因为请求中没有实体实体。