I recognize those as being from IO::Socket. Presumably, IO::Sockets objects can't be shared. Create your connection in the thread where you use it. Your current model doesn't make much sense anyway. Why would you do the slow operation of connecting outside of the thread only to pass the object to the thread?

sub method { my ($self, $deviceInfo, $count) = @_; my $machine = Connector->new($deviceInfo); while ($count) { my ($status, $hostname) = $self->cmd("hostname"); print "$count: $hostname\n"; sleep 1; --$count; } } my $thr1 = threads->create( 'method', $deviceInfo1, 10 ); my $thr2 = threads->create( 'method', $deviceInfo2, 6 );

Net-SSH2 is a threadsafe module, as far as I know.

What gives you that idea? That's a dangerous assumption to make, especially where XS code and external libraries are concerned.


In reply to Re: Attempt to free non-existent shared string 'io_socket_type', Perl interpreter: 0x84972e0 during global destruction. by ikegami
in thread Attempt to free non-existent shared string 'io_socket_type', Perl interpreter: 0x84972e0 during global destruction. by madhurikl

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.