develooper Front page | perl.perl5.porters | Postings from March 2003

Re: [perl #21614] 5.8.0 Unbalanced string table refcount

Thread Previous | Thread Next
Nicholas Clark
March 22, 2003 09:31
Re: [perl #21614] 5.8.0 Unbalanced string table refcount
Message ID:
On Wed, Mar 19, 2003 at 03:57:21AM -0000, Paul Dyer wrote:

> Here is the error log:
> Unbalanced string table refcount: (1) for "Oracle.txt" during global destruction.

On Fri, Mar 21, 2003 at 05:52:49PM +0100, Rafael Garcia-Suarez wrote:
> Paul Dyer wrote:
> > 
> > I'm attaching the whole script.  I am running under Apache, ModPerl.   
> It's possible that it's a mod_perl problem. The startup/shutdown process of
> mod_perl is more complicated than for a standalone perl interpreter.
> It's possible also that the problem is not related at all to mod_perl, but
> in this case, to fix it, it would be handy to be able to replicate it without
> mod_perl.

I'll second that. I can't replicate it here with pure perl - I don't have
modperl or a UTF8 locale.

> Anyway, the error you're getting is an (undocumented) internal warning
> that occurs on destruction of a perl interpreter. It's probably harmless.

I'm surprised that there is only 1 error line. I thought that unbalanced string
table refcounts usually came in pairs - one was too high, and another was too
low. (effectively a matched set).
I wonder if something in the internals is clearing all the flags in $_ at some
point, rather than correctly undef()ing it. In 5.8 keys will generate a list of
scalars which point directly to the string table used for hash keys
(this is the table that the error message refers to)
In turn, foreach aliases $_ to the items in the list, so $_ is pointing into
the string table. If the internals clear $_ properly, then the string table
reference is tidied up, and everything balances. But if something (I'm
suspicious of the inner foreach) just blasts $_ instead, then the reference
is lost.

> >  I used the Apache::File and IO::File modules and got the errors on both.
> > 
> > I am using RedHat 8.0 and 7.3 with the same results.   I don't know what 
> > the character set is.
> The output of the locale command is usually sufficient.

the output from perl -V would contain it. (plus a lot of other information)

If you're able to make a test case that doesn't need mod_perl that would be
really useful. I think that the string table reference counts are only checked
on perl compiled with -DDEBUGGING. I presume that the perl you have is, given
that mod_perl is warning. You can check - this perl is suitable:

$ perl5.8.0-32-g -D -e0


This perl is not:

$ perl5.8.0 -D -e0
Recompile perl with -DDEBUGGING to use -D switch

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About