(aka. Joining the "Perl 5.8.2 threads are much worse" cult)

I would just like to add something to the two previous meditations regarding Perl 5.8.2 threading being much worse than earlier 5.8 versions but started a new meditation as it's my first one :) Ok, that, and I'm dealing with databases.

Certain people may have noticed that I am having a few troubles with Perl 5.8.2, threading and Oracle 9i database connections under Solaris 8 (for sparc).

After recent advice from a member of the Perl DBI mailing list I built Perl 5.8.0 with threading support and compared the results against Perl 5.8.2 threads.

Code snippet 1:

#!/opt/bin/perl use threads; use DBI; @threads; printf "Starting thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $threads[$i] = new threads(\&do_db); } printf "\n"; printf "Joining thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $thread = $threads[$i]; $thread->join; } printf "\n"; sub do_db { my $dbh = DBI->connect("dbi:Oracle:host=localhost;sid=testdb1" +, "user1", "pass1") || die $!; }

under 5.8.2 started all threads but then core dumped when trying to join. Under 5.8.0 this code seems to work fine.

Code snippet 2:

#!/opt/bin/perl use threads; use DBI; our $orashr : shared = '' ; @threads; printf "Starting thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $threads[$i] = new threads(\&do_db); } printf "\n"; printf "Joining thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $thread = $threads[$i]; $thread->join; } printf "\n"; sub do_db { my $dbh = DBI->connect("dbi:Oracle:host=localhost;sid=testdb1" +, "user1", "pass1", { ora_dbh_share => \$orashr} ) || die $!; }

under 5.8.2 core dumped after only starting a handful of threads. Under 5.8.0 it starts all the threads fine but then dumps core when trying to join them.

I am most interested in the latter code and as it still dumps core Perl 5.8 threads are of no use to me. Yet. However, I believe this does highlight one thing - the behaviour under 5.8.0 threads compared to 5.8.2 threads is better. Things either don't crash, or crash at a later point, but things work better.

I wonder why threads in 5.8.2 are causing so much bother...

== fx, Infinity Is Colourless


In reply to I too don't like Perl 5.8.2 threads by fx

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.