0

I have a web service(FastAPI) deployed on AWS EC2.

In java client code, when I call the api, i got this error

org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 3,849,324; received: 1,834,837)

In postman, when I call this api, the response is returned but not enough like this image enter image description here

Seem the server (Fast API web service) do not return all data in response body.

I already check this question, the accepted answer said that this error is belong server-side.

So what is the problem here? What can I configure to solve this problem, on the AWS or my web service or any ?

Additional information, in the API implementation, business logic is connect to the AWS S3 and download some files. I don't know if this is the problem but when I looked for solution, a lot of people said it related to AWS S3

Thank you all guys!!!

Puskin
  • 125
  • 1
  • 11
  • The problem is that server sent a response stating that response length is `3,849,324` bytes in the header, but actual payload was only `1,834,837` bytes after which the server closed the connection - at least that's what I understand. – kiner_shah Jan 24 '22 at 06:25
  • Oh I understand that too. But it has no meaning, lol. I don't know why this happened then I can't fix this – Puskin Jan 24 '22 at 06:42
  • You need to check server side. – kiner_shah Jan 24 '22 at 06:48
  • 2
    Did you check if you are returning the response before filling up the response data? May be a timing issue? You can test the below thing. Support your data are stored in B then, first of all, log that data in somewhere like in cloud log and then return it. so that you can trace that data. – helper Jan 24 '22 at 17:36
  • It can be a latency & time-out issue. Check for S3's region for latency and the time-out. Or maybe, you can try to get values in batches. – stuck Jan 29 '22 at 22:01

1 Answers1

1

After several investigating hours. My leader found the issue, it's out of memory issue. It is out of Hard disk driver instead of RAM. Lol

Puskin
  • 125
  • 1
  • 11