I think what's happening is this:

Below is a piece of code that illustrates this:
use strict; use threads; use threads::shared; my $fct = sub { # eval {require Blah; Blah->import()} or print $@; require Blah; Blah->import(); }; my $thr = threads->new($fct); #$thr->join();
When executed as is, it produces the following output:
Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached
If I remove the comment in front of the last line (the join call), then I get error message:
Thread 1 terminated abnormally: Can't locate Blah.pm in @INC (@INC con +tains: etc...
Note also that the eval {} trick doesn't seem to make any difference. In other words, if I remove the comment in from of the eval {} line but leave the join() statement commented out, I still don't get the error message.

Note also that the silent dying does not happen if, for example, the error is caused by a division by zero instead of a non-existant include file.

Also interesting is the fact that if I do "use Blah;" instead of "require Blah; Blah->import()", then I see the error message, even if the join call is commented out.

In case you are wondering why I use a require instead of use, it's because loading the Blah module may end up loading modules which are not thread-safe. Therefore, I want to load the module at run-time, not at compile time (as explained on this node: http://www.perlmonks.org/?node_id=288022).

In reply to Re^2: Why do my threads sometimes die silenty? by alain_desilets
in thread Why do my threads sometimes die silenty? by alain_desilets

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.