Why j.i.IOException: Premature close -Error

Hi, we are doing load test with scenario: api request to download files about 800M. Gatling version 3.7.6, configuration is by default. Sometimes not always that will get this error j.i.IOException: Premature close -Error. I didn’t find any error in server side, no details error on gatling either. I struggled on this for a long time:

  • even upgrade gatling to 3.9.5, still have issues occasionally.
  • open logback DEBUG log into file, will met another memory issue reported by gatling

Do you have any recommendations to investigate?

I checked our server, 8400 request, NGINX report status code 200. Does that mean some error in Gatling side?
image

Hi @maggie,

First, the latest version (presently) is 3.10.3

About the “Premature close” exception, it means that the connection socket between Gatling and your server was closed before reaching the end of the body.

Possibilities that come into mind:

  • An intermediate server (proxy) forcely close the connection at some time
  • Wrong value for Content-length header.
  • Server answers correctly with 200 and correct headers, but don’t let the connection ends to transmit the full body (or the body is corrupted)

Gatling is only the messenger here.

Cheers!

Hi @sbrevet,

  • We didn’t specify any special header.
  • any possibility that gatling will close the connection while reading the content?
  • how to enable the error log, so that we know which request failed?
    Our arch is like: Gatling send request to AWS ELB and then to NGNIX and S3 after that. I will check with aws support.

Thanks!
BR,

The best way to investigate network issues is Wireshark.

Hi,
Thanks for advice. We have tried, and from wireshark we saw server tried to test whether client keep-live, after about 8 times, no ack from client side, server close connection.

Any log can be enabled to see more details in gatling during performance test?
Some times, we got 400 error in gatling, but don’t know what kind of. It will be good if can log some error during test phase.

Thanks!
BR,

Hi,

  1. Have you upgraded your Gatling version?
  2. It’s really weird that your server needs to send KA segments. First, I wouldn’t expect connections to stay idle in a load test. Then, Gatling closes connections from the client side when they are idle or when the virtual user terminates.
  3. The TCP stack is in charge of ACK’ing the KA TCP segments, not something in user space like Gatling.

I’m afraid we can’t help unless you provide a reproducer.

@maggie
Any log can be enabled to see more details in gatling during performance test?
Some times, we got 400 error in gatling, but don’t know what kind of. It will be good if can log some error during test phase.

If you are using bundle version, please check out conf/logback.xml. There you will see this

	<!-- uncomment and set to DEBUG to log all failing HTTP requests -->
	<!-- uncomment and set to TRACE to log all HTTP requests -->
	<logger name="io.gatling.http.engine.response" level="DEBUG" />

You can enable TRACE to see all success and fail requests, or DEBUG for fail requests only.

1 Like

This won’t help with seeing what happens at the TCP level in kernel space.

1 Like

Hi,
Another question related to this topic: how to limit the download speed from gatling side? We hope to simulate bad network to do download test.

https://man7.org/linux/man-pages/man8/tc-netem.8.html

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.