简体   繁体   English

MalformedChunkCodingException:分块的流意外结束

[英]MalformedChunkCodingException: Chunked stream ended unexpectedly

Enter code here I've implemented an SSE server and client. 在这里输入代码我已经实现了SSE服务器和客户端。 The server is implemented using Netty and the client uses Apache http client . 服务器使用Netty实现,客户端使用Apache http client

If I send a message at least every 30 seconds it all seems to work fine, but if I do not I will intermittently get this exception: 如果我至少每30秒发送一条消息,那么一切似乎都可以正常工作,但是如果我不这样做,则会间歇性地收到此异常:

```
 Caused by: org.apache.http.MalformedChunkCodingException: Chunked stream ended unexpectedly
    W/System.err( 2879):    at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:222)
    W/System.err( 2879):    at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:183)
    W/System.err( 2879):    at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:155)
    W/System.err( 2879):    at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:159)
    W/System.err( 2879):    at java.io.InputStreamReader.read(InputStreamReader.java:244)
    W/System.err( 2879):    at java.io.BufferedReader.fillBuf(BufferedReader.java:130)
    W/System.err( 2879):    at java.io.BufferedReader.readLine(BufferedReader.java:354)
    W/System.err( 2879):    at com.clover.engine.push.SSEConnection$1.call(SSEConnection.java:85)
    W/System.err( 2879):    at com.clover.engine.push.SSEConnection$1.call(SSEConnection.java:79)
    W/System.err( 2879):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
```

Right now I'm sending a keep alive message every 30 seconds, but I'd prefer to not have to. 现在,我每30秒发送一条保持活动状态的消息,但我不想这样做。

Any suggestions on how to prevent this exception from occurring? 关于如何防止此异常发生的任何建议?

导致此异常的原因实际上是haproxy,它在空闲时间过长时关闭了套接字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 泽西服务器JSON响应引发MalformedChunkCodingException:分块的流意外结束 - Jersey server JSON response throwing MalformedChunkCodingException: Chunked stream ended unexpectedly 直播意外结束 - Stream ended unexpectedly 为什么在使用 HttpClient 时分块流意外结束? - Why am I getting chunked stream ended unexpectedly when I use HttpClient? Apache Commons文件上传 - Stream意外结束 - Apache Commons File Upload - Stream ended unexpectedly 为什么我用Apache Commons FileUpload获得“FileUploadException:Stream意外结束”? - Why did I get “FileUploadException: Stream ended unexpectedly” with Apache Commons FileUpload? Java-IE中的FormData抛出org.apache.commons.fileupload.MultipartStream $ MalformedStreamException:流意外结束 - Java - FormData in IE throwing org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly IE 11:发送Multipart Form Data请求时出错:Stream意外结束 - IE 11: Error while sending Multipart Form Data request: Stream ended unexpectedly Netty分块输入流 - Netty chunked input stream Java,MalformedChunkCodingException - Java, MalformedChunkCodingException FirestoreException:后端已结束侦听流 - FirestoreException: Backend ended Listen Stream
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM