For info, the actual program in which this logic appears does this:

Now that would be interesting to see...

But for this specific problem, I modified your thread code as follows:

sub RunThread { my $tid = threads->tid; my $dbh = DBI->connect("DBD::Pg",...) or die "failed connect"; my ($x, $y)=@_; open (my $fh2, ">/tmp/da-$x-$y") or die "failed in thread $! at it +er $x thread $y " ; print "$tid : ", fileno( $fh2 ); sleep 1; close ($fh2); $dbh->disconnect or die "disconnect failed"; }

When I run that, I get the following which shows that the filenos underlaying the file handles are being reused by each new batch of threads. If you don't see similar, then it probably means that Solaris/Perl on your system is downlevel or broken.

[19:04:06.98] c:\test>DBjunk.pl 1 : 3 2 : 4 3 : 5 4 : 6 5 : 7 6 : 8 8 : 9 10 : 10 9 : 11 7 : 12 12 : 13 14 : 14 13 : 15 11 : 16 15 : 17 16 : 3 17 : 4 19 : 5 18 : 6 20 : 7 21 : 8 22 : 9 23 : 10 24 : 11 25 : 12 27 : 3 28 : 4 26 : 5 29 : 6 30 : 7 31 : 8 32 : 3 33 : 4 34 : 5 35 : 6 36 : 7 37 : 8 38 : 9 39 : 10 40 : 11 41 : 12

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^3: Too many open files error with DBD Oracle by BrowserUk
in thread Too many open files error with DBD Oracle by JoeW

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.