Subject: | AnyEvent::HTTP::LWP::UserAgent leaks sockets |
Date: | Thu, 22 Oct 2015 14:53:48 +0300 |
To: | bug-AnyEvent-HTTP-LWP-UserAgent [...] rt.cpan.org |
From: | Jussi Kinnula <jussi.kinnula [...] gmail.com> |
There’s apparent socket leak on AnyEvent::HTTP::LWP::UserAgent. The problem persists on couple of hours uptime on normal occasions. For example Facebook logins (Facebook::Graph module uses AnyEvent::HTTP::LWP::UserAgent) start to fail with unambiguous error message "No such device or address”, which, I think is related that AnyEvent::HTTP::LWP::UserAgent leaves the sockets open, and when the system runs out of sockets the failing happens.
I have made up a test case, which results the error in very short period of time - at the moment the test script can be run on isolated environment on Heroku platform with Perl 5.22.0 with the instructions provided in the test case:
https://github.com/jussikinnula/socket-leak-test <https://github.com/jussikinnula/socket-leak-test>
I did post a pull request also to Facebook::Graph module to switch on using regular LWP::UserAgent instead, however, I think that the problem should be also fixed on the AnyEvent::HTTP::LWP::UserAgent side. Please note, that the actual error might also rely on the dependencies (such us AnyEvent::HTTP, or AnyEvent::Socket). So far I’ve only reproduced the issue on HTTPS hosts, which might give a pointer for a fix.