Request Failed: x509: failed to load system roots and no roots provided; open /etc/ssl/certs/ca-certificates.crt: too many open files

Hello, I’m getting this error once I reached a 100+ VUs? on a WebApi (https)? Any help?

Hi,

What is happening is that k6 is opening more files than what the limit on your machine is. This is fairly normal as we are making a lot of HTTP requests and all tcp connections are counted as open files. It is strange that we are opening the certificates in the middle of the execution so that might be optimized. Either way you are going to hit the limit with normal http requests if not with the opening of the certificates.

You will have to raise the limit which is usually low as the majority of programs on a desktop/server will not need all that many. I would recommend going through this blog post and using one or more of the ways to raise the limit to something like twice the amount of http requests you are expecting to have at any given time. Of course you can just raise it a lot more ;).

1 Like

Thanks A lot dear mstoykov, this has fixed the issue.