This week one of my customer's websites suddenly start showing the message "Unexpected error communicating with Stripe. If this problem persists, let us know at firstname.lastname@example.org (Network error errno 2: comfortable handle already used in the multi handle). It was an unusual error as the code error was different from some of the error code we use to see.Moreover, we could not quickly figure out the source of the error. After more than two days of searching, we were able to find a fix that we want to share with you. In case you suddenly have such an error on your Magento Checkout website, this small article can help you to fix the issue.
More about the issues and the technology throwing the Network error errno 2
From our findings, we understood that the issue is not explicitly related to Magento 2; but the CURL version. For instance, many people reported on Github and StackOverflow how suddenly their Stripe stopped working. Or their email system couldn't work and was showing the Network error [errno 2]. A discussion on Github shows that the issue is still under investigation. In case you are using a technology different from Magento, you can take a look at this link
to understand how to fix the issue on your site.
How to fix Network error errno 2 on Magento 2 for Stripe?
If you encounter Network error [errno 2] on your Magento 2 website, cause your stripe or payment method not to work, you can do the following.
- Access your Magento 2 installation folder
- Check the file "vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php."
- And then change :
protected $enablePersistentConnections = true;
protected $enablePersistentConnections = false;
- Finally, save and try to checkout.
If you follow the steps above, you will see that your checkout will work correctly.
More alternatives to fix the issue
From the discussion on the internet, some people were able to fix the problem by using either of this method :
- Updating their server version,
- Downgrading their curl version or
- Upgrading their website
Conclusion and final thought
There is a possibility that the issue occurs on some other modules of your website. But from my understanding, setting the persistent connection/HTTP keep-alive to false, you will have a temporary fix. As one of the Stripe support team mentioned, the suggested approach above is a temporary fix. There are still investigating internally. Here I state a comment from Github
. "Note however that this is just a workaround, not a proper fix, and is suboptimal because it disables persistent connections (meaning every request to Stripe's API will create a new connection, causing additional latency)."Thanks for reading. I hope the article will help you save a couple of hours. If you need help with any of your Magento Project, you can contact us