develooper Front page | perl.perl5.porters | Postings from November 2006

Re: Trouble with PERLIO_INIT/PERLIO_TERM changes

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
November 30, 2006 03:20
Subject:
Re: Trouble with PERLIO_INIT/PERLIO_TERM changes
Message ID:
456EBE32.90804@iki.fi
> 
> Why don't you have Foo.xs? It's in the test distro that I sent before, 
> along with the test.pl:
> 
> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-11/msg01064.html

Duh, yes, bad day yesterday.

>> Basically the thing with the PERLIO_DEBUG log is that open (and up)
>> increment the refcnt, close decrements it.  If they don't match,
>> something is internally wrong with perlio, or something bypassed
>> perlio.
> 
> The debug.txt that I sent (did you get that alright?) makes only two 

Yes.

> mentions of fd 4:
> 
> test.pl:0 refcnt_inc: fd 4 refcnt=1
> test.pl:10 refcnt_dec: fd 4 refcnt=0
> 
> so nothing looks like it doesn't match, and yet it still croaks with the 
> message:
> 
> refcnt_dec: fd 4: 0 <= 0
> 
> I'm guessing that the file was opened (inc refcnt to 1), then closed 
> (dec refcnt to 0) and then some attempt was made within PerlIO to close 
> it again (triggering the croak)?

That would make it, yes.  Maybe fire up a debugger and set a breakpoint
to the croak() in PerlIOUnix_refcnt_dec()?  Compare the stack trace with
the one if coming from a (Perl-level) close()?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About