Fellow Monks,

I come to you to learn wisdom about HTTP::Proxy
I am trying to use it with threads and even the simplist of code spits out information that makes me question if it is thread safe. Everything is working fine, but the window I am running my script receives "exit status information" everytime something is performed. If someone tells me this is normal behavior for HTTP::Proxy when using threads, I only ask to know why?

Here is the code I used:
use strict; use warnings; use HTTP::Proxy; use threads; #Let's define the threads to be undef my $thr1 = undef; my $thr2 = undef; #Control Server my $Server_IP = "192.168.0.1"; my $Server_Port = 30000; $thr1 = threads->create(\&StartServer_HTTP,1); $thr2 = threads->create(\&StartServer_HTTP,2); $thr1->join(); $thr2->join(); sub StartServer_HTTP{ use HTTP::Proxy; my $thid = threads->tid(); my $port = $Server_Port + $thid; print STDOUT "Server started on port: <$port>\n"; my $proxy = HTTP::Proxy->new( host => $Server_IP, max_client => 100, max_keep_alive_requests => 1, port => $port ); $proxy->start; }

When I run the code all seems fine. I mean the system is identifying two running proxies, but when I use one of them (setup browser to use proxy on port 30001 and point to a page), I receive a bunch of the following from the window I started the script.
Server started on port: <30001> Server started on port: <30002> Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached

The 'Perl exited with active threads:' and the lines that follow each one of these lines is an exact one-to-one ratio with the pages being pulled back through the proxy. It would be most appreciated if someone could explain this to me and if it is safe to use. You wisdom on this matter is humbling.

In reply to Is HTTP::Proxy thread safe? by locked0wn

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.