Looking at your first snippet, and going on gut reaction, I think that the problem is that one or more elements of the code that is being loaded under the auspices of use DBI;, isn't thread-safe.

That is to say, even though each of your threads is getting it's own instance of DBI (and everything that encapsulates), somewhere in that mix, the is a piece of XS or C code that is retaining state in some internal variable. When you create multiple instances within the same process, although Perl is keeping the various perl-level state separated, the internal state at the XS or C level is being shared without any form of interlocking, and it is this that is probably causing the core dump.

Even the standard C-libraries have some standard calls which retain internal state (eg. strtok()), and unless the libraries you are using are specifically thread-enabled, allocating and accessing their internal state indexed by calling thread id, then using such calls in threaded apps is usually fatal.

XS code for modules written prior to the existance of perl's threading will be especially vulnerable to this, and unless the code has been updated very recently to accomodate threading, DBI and its dependanceies are quite lightly to suffer this problem.

You might be able to use liz's forks module as a drop-in replacement for threads and avoid these problems. It's definately worth a look.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!


In reply to Re: Threading (Perl 5.8 ithreads) with Oracle 9i dumps core by BrowserUk
in thread Threading (Perl 5.8 ithreads) with Oracle 9i dumps core 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.