I am running RT 4.4.2 on Apache/2.4.25. I want to make a GET request to server from my custom page inside RT. Here is the relevant part of code:
#!/usr/bin/perl use strict; use warnings; use IO::Socket::SSL 'debug3'; use LWP::UserAgent; use LWP::ConsoleLogger::Everywhere (); use JSON; BEGIN { $ENV{HTTPS_DEBUG} = 1; $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = 'IO::Socket::SSL'; # force + LWP::UserAgent to use Net::SSL in case that IO::Socket::SSL is insta +lled too } sub log_list { my $par = shift; my $list = shift; my $query = "https://server.com/script.cgi?action=aaa&par=" . $par + . "&"; my $ua = LWP::UserAgent->new(); $ua->ssl_opts( SSL_cert_file => '/path/to/cert', SSL_key_file => '/path/to/key', SSL_version => 'TLSv1_2', verify_hostname => 0, ); my $res = $ua->get($query); if($res->is_success) { my $json = $res->decoded_content; my $decoded_json = decode_json($json); push (@$list, @{$decoded_json->{'result'} }); } else { die $res->status_line; } } my %list; log_list('value', \%list); print %list;

When I run this as a separate script from the command line I get the correct result. But when I put it in a Perl module and call it from HTML page in RT I get following error in logs:

DEBUG: .../IO/Socket/SSL.pm:862: ssl handshake done DEBUG: .../IO/Socket/SSL.pm:1106: SSL read error DEBUG: .../IO/Socket/SSL.pm:1106: local error: SSL read error error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

And this is in response (looks like it was created on local machine):

Status read failed: at /usr/local/share/perl/5.24.1/Net/HTTP/Methods.pm line 282.

It fails when reading from the socket. I tried this with another SSL Socket implementation - Net::SSL It works for a few hours but then errors start appearing with increasing frequency until it does not work at all. I get the same error in response. It starts to work again when I restart the apache service. Therefore I think there might be some race condition when reading from the socket and it has little to do with the handshake (from the script the handshake works all the time). I am stuck here. What can cause this and how can I get more information about this problem?


In reply to Apache - read from socket problem by Stetec

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.