Open na-- opened 5 years ago
Slightly connected to this, but we should see if we properly detect the too many open files
error. It deserves its own dedicated error code, and a message pointing users to instructions how to increase their OS limits.
Something else strange is that the connection reset by peer
error message includes the local and remote IPs and port numbers, something that should be overwritten by this code, but for some reason isn't:
https://github.com/loadimpact/k6/blob/a2077dd22a86662ef3cd699bc57b0048136e51ba/lib/netext/httpext/error_codes.go#L137-L138
We don't handle error messages and error codes for request timeouts properly. Consider the following script:
import http from "k6/http";
export default function () {
let resp = http.get("https://httpbin.org/delay/5", { timeout: 3000 });
console.log(resp.error);
console.log(resp.error_code);
}
with k6 v0.26.1, we'd get something like this:
WARN[0003] Request Failed error="Get https://httpbin.org/delay/5: context deadline exceeded"
INFO[0003] context deadline exceeded
INFO[0003] 1000
and with k6 v0.26.0:
WARN[0003] Request Failed error="Get https://httpbin.org/delay/5: net/http: request canceled (Client.Timeout exceeded while awaiting headers)"
INFO[0003] net/http: request canceled
INFO[0003] 1000
The difference in error message is probably caused by https://github.com/loadimpact/k6/pull/1261, but in both cases we don't handle the error code properly.
Quite a lot of errors now result in an
error_code
metric tag value of1000
, i.e. the most generic catch-all error code we have. In a recent sample of production errors, here are the aggregated counts of errors with 1000 forerror_code
:The
http: Request.ContentLength=??? with nil Body
error is better described in https://github.com/loadimpact/k6/issues/1094, while theGetBody
-mentioning error is already fixed inmaster
by https://github.com/loadimpact/k6/pull/1093.Also, it might be a good idea to rename the current
errCode
type and the constants, as discussed in https://github.com/loadimpact/k6/pull/1102#discussion_r310889060