lbrandewie has asked for the wisdom of the Perl Monks concerning the following question:

Hey Folks,

I've been using code like the following:

use LWP; use strict; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get("https://cnn.com/"); if ($response->is_success) { print "Yay!"; # process success } else { print "Rats!"; # process failure }

to retrieve documents off the internet. The problem comes when you try to retrieve an https document. You get neither a success nor a fail indication, but rather a fatal library error:

Free to wrong pool 2f5840 not 8900000f60944183 at C:/Perl64/lib/IO/Soc +ket/SSL.pm line 2739.

I contacted Activestate and they acknowledge that it's their bug. They say that versions of Net-SSLeay prior to 1.85 are not thread safe, and this is the reason for the crash.

You can check the following link to see when Net-SSLeay gets upgraded:

https://platform.activestate.com/ActiveState/ActivePerl-5.28/customize

Thanks,

Lars

Replies are listed 'Best First'.
Re: Net-SSLeay problem in perl for Windows
by syphilis (Archbishop) on Dec 18, 2019 at 02:38 UTC
    Hi,

    If the reason for the crash is, as they've told you, that Net::SSLeay is too old then you're only option is to obtain a more recent version of Net::SSLeay.
    If ppm is unable to provide the update then you'd have to build and install a later version from the Net::SSLeay source distribution.
    Another alternative is to install a fresh perl installation that either includes a later Net::SSLeay or provides a ppm package for it.

    Hint: Strawberry Perl 5.30.0 ships with Net-SSLeay-1.88 already installed.

    Cheers,
    Rob

      Strawberry also seems to work quite nicely with Komodo IDE as far as i remember.

      But to tell the truth, i've been using ActivePerl for a decade on and off for developing windows tools. The included SSL stuff was always a bit flaky and worked in some ActivePerl versions and behaved oddly or was just plain broke in many others.

      After ActiveState stopped supporting the PDK (i used it to make windows services), i switched to Strawberry but kept using Komodo. Even when using ActivePerl, i build as much as possible from CPAN (yes it's included in the install) and avoided ActiveStates precompiled and outdated modules - working with the precomipled stuff always felt too much like "Debian Stable" (a.k.a. the retirement home for old software).

      perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

      Thanks, investigating that now.

      Lars

        Strawberry perl makes my test code run fine, so that's solved. But my app does not because the Tkx libraries are not included (it's a GUI app). My simple attempt to install them using "cpan Tkx" failed because Tcl wouldn't install for some reason. Trying "cpan Tcl" also failed, apparently because it calls tclsh, which doesn't exist.

        For additional fun, I reinstalled ActivePerl and tried "cpan Net::SSLeay" which failed because it said it couldn't find OpenSSL. "cpan OpenSSL" failed because it couldn't find the namespace. I would seem to be stuck until ActiveState updates their code.

        Lars

Re: Net-SSLeay problem in perl for Windows
by bliako (Abbot) on Dec 17, 2019 at 21:30 UTC

    I don't know why that *exact* code fails if LWP::UserAgent is not using threads internally (that's my impression). Unless you are using your code in a multi-threaded program?

      That exact code does fail with the message shown, and not in a multithreaded app. I am developing a multi-threaded app but I pulled the code to a test program that also fails. Perhaps this means some portion of the library code is multi-threaded. HTH.