Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LWP over HTTPS eats up to 100% of CPU on either slow connection or server [rt.cpan.org #80444] #34

Open
oalders opened this issue Mar 31, 2017 · 0 comments

Comments

@oalders
Copy link
Member

oalders commented Mar 31, 2017

Migrated from rt.cpan.org#80444 (status was 'new')

Requestors:

From pavel.strashkin@gmail.com on 2012-10-28 04:13:45:

Hello there,

The reason why it happens (subject) is because it calls read/sysread millions of
times without waiting for read event. It fails with EAGAIN. I was
looking at the code and here is what i saw:

== lib / LWP / Protocol / https.pm ==
our @ISA = qw(Net::HTTPS LWP::Protocol::http::SocketMethods);
== lib / LWP / Protocol / https.pm ==

The parents order. Because Net::HTTPS goes first, it handles the sysread call.
That means sysread/can_read/select/sysread sequence from SocketMethods
never happens.
Looks it easy to fix, but it is not. You can't just change the order.
In this case sysread would not reach IO::Socket::SSL.

What i could do and it actually worked for me is copy/paste
sysread/can_read from SocketMethods and call IO::Socket::SSL::sysread
at the end. I guess there should be better way.

Thank you!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant