Jetty:Spring Boot 2中JSON反序列化的空闲超时过期异常

问题描述 投票:0回答:1

当Spring Boot 2.0服务器处理传入请求时,我偶尔会看到类似以下的堆栈跟踪。我正在使用带有spring-boot-starter-jetty的Spring Boot 2.2.4。仅在大约0.1%的时间发生此异常。有没有人看过类似的东西,对为什么会这样有任何想法?该服务在Application Load Balancer后面的AWS EKS中运行。

j.u.c.TimeoutException: Idle timeout expired: 30001/30000 ms
    at o.e.j.io.IdleTimeout.checkIdleTimeout(IdleTimeout.java:171)
    at o.e.j.io.IdleTimeout.idleCheck(IdleTimeout.java:113)
    at j.u.c.Executors$RunnableAdapter.call(Executors.java:515)
    at j.u.c.FutureTask.run(FutureTask.java:264)
    at j.u.c.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
    at j.u.c.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at j.u.c.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    ... 1 common frames omitted
    Suppressed: java.lang.Throwable: HttpInput failure
        at o.e.j.s.HttpInput.failed(HttpInput.java:830)
        at o.e.j.s.HttpConnection$BlockingReadCallback.failed(HttpConnection.java:656)
        at o.e.j.i.FillInterest.onFail(FillInterest.java:138)
        at o.e.j.i.AbstractEndPoint.onIdleExpired(AbstractEndPoint.java:407)
        ... 8 common frames omitted
Wrapped by: java.io.IOException: java.util.concurrent.TimeoutException: Idle timeout expired: 30001/30000 ms
    at o.e.j.s.HttpInput$ErrorState.noContent(HttpInput.java:1083)
    at o.e.j.s.HttpInput.read(HttpInput.java:321)
    at c.r.p.e.s.c.s.MeasurableRequestWrapper$CountingInputStream.read(MeasurableRequestWrapper.java:62)
    at j.i.FilterInputStream.read(FilterInputStream.java:133)
    at j.i.PushbackInputStream.read(PushbackInputStream.java:183)
    at c.f.j.c.j.UTF8StreamJsonParser._loadMore(UTF8StreamJsonParser.java:220)
    at c.f.j.c.j.UTF8StreamJsonParser.parseEscapedName(UTF8StreamJsonParser.java:1985)
    at c.f.j.c.j.UTF8StreamJsonParser.parseLongName(UTF8StreamJsonParser.java:1872)
    at c.f.j.c.j.UTF8StreamJsonParser.parseMediumName2(UTF8StreamJsonParser.java:1810)
    at c.f.j.c.j.UTF8StreamJsonParser.parseMediumName(UTF8StreamJsonParser.java:1767)
    at c.f.j.c.j.UTF8StreamJsonParser._parseName(UTF8StreamJsonParser.java:1702)
    at c.f.j.c.j.UTF8StreamJsonParser.nextFieldName(UTF8StreamJsonParser.java:1029)
    at c.f.j.d.d.s.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:512)
    at c.f.j.d.d.s.MapDeserializer.deserialize(MapDeserializer.java:364)
    at c.f.j.d.d.s.MapDeserializer.deserialize(MapDeserializer.java:29)
    at c.f.j.d.d.s.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
    ... 124 common frames omitted
Wrapped by: c.f.j.d.JsonMappingException: java.util.concurrent.TimeoutException: Idle timeout expired: 30001/30000 ms (through reference chain: com.abc.service.api.resources.SalesDataRequest["details"]->java.util.ArrayList[0]->com.abc.service.api.resources.SalesDataRequest$SalesDataDetail["events"]->java.util.ArrayList[2])
    at c.f.j.d.JsonMappingException.wrapWithPath(JsonMappingException.java:394)
    at c.f.j.d.JsonMappingException.wrapWithPath(JsonMappingException.java:365)
    at c.f.j.d.d.s.CollectionDeserializer.deserialize(CollectionDeserializer...
spring jackson jetty
1个回答
1
投票

您有一个正在请求正文上提供数据的连接(因此,HttpInput引用为它。

数据处于阻塞读取(HttpInput.read())中,等待更多数据。

然后,该连接的空闲超时开始,并且读取失败,并显示HttpInput.noContent(),表明读取不完整,是造成空闲超时的嵌套原因。

这是标准的空闲超时方案。

不是那么不寻常或不寻常。

对于移动客户端(移动塔式交换机,不良的网络连接,从蜂窝塔切换到wifi或再次返回等)非常常见。笔记本电脑上的浏览器甚至会发生这种情况(WiFi问题,浏览器崩溃,电池问题,机盖关闭,睡眠模式等。)

实际上只有您的请求的1%会发生这种情况(实际上,在具有公开问题的网站上,存在网络问题的请求所占的百分比更高)

© www.soinside.com 2019 - 2024. All rights reserved.