in reply to perl bug? illegal seek with dup and many filehandles

I have found two ways around the limit (with thanks to almut):

  1. Run perl with environment variable PERLIO set to :stdio
  2. Recompile perl with PERLIO_MAX_REFCOUNTABLE_FD in perlio.c set to a suitably large number

Running perl with PERLIO set to :stdio makes perl use standard IO libraries instead of its own. This avoids the hard coded limit on file descriptor reference counts in perl's IO routines but note the warning in perlio.c:

/* This file contains the functions needed to implement PerlIO, which * is Perl's private replacement for the C stdio library. This is used * by default unless you compile with -Uuseperlio or run with * PERLIO=:stdio (but don't do this unless you know what you're doing) */

I recompiled perl with PERLIO_MAX_REFCOUNTABLE_FD set to 32768 and your test script ran to successful completion. Tests on the recompiled perl ran ok.

Replies are listed 'Best First'.
Re^2: perl bug? illegal seek with dup and many filehandles
by wumpus (Sexton) on Feb 06, 2010 at 01:29 UTC
    Thanks for this solution -- I ran into it & didn't waste much time, thanks to you.