[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: building mod_perl-2.0.3 with Perl 5.10.0 (DEVEL32096)


PerlIO_teardown() calls PerlIO_debug(), which doesn't take an aTHX
argument, but assumes the TLS still points to a valid interpreter (it
contains a dTHX macro call). This seems like a bad assumption to me;
calling PERL_SYS_TERM before all interpreters have been destroyed is
a bug. Therefore I think PERL_SYS_TERM shouldn't require an aTHX,
and PerlIO_teardown either shouldn't call PerlIO_debug, or
PerlIO_debug needs to be written to work without having an
interpreter still being alive.

Cheers,
-Jan

On Fri, 02 Nov 2007, Dave Mitchell wrote:
> [ snip description of problems compiling mod_perl now that PERL_SYS_TERM
> expects a my_perl in scope ]
> 
> It appears that PERL_SYS_TERM first started needing a context with
> 
>     Change 29060 by suppressed on 2006/10/20 10:20:18
> 
> 	    More leak fixes, by Jarkko
> 
>     ...
> 
>     -#define PERL_SYS_TERM()		HINTS_REFCNT_TERM; OP_REFCNT_TERM; MALLOC_TERM
>     +#  define PERL_SYS_TERM()		HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM
> 
>     ...
> 
>     +#  define PERLIO_TERM	PerlIO_teardown(aTHX)
> 
>     ...
> 
>     +void PerlIO_teardown(pTHX) /* Call only from PERL_SYS_TERM(). */
>     +{
>     +#ifdef DEBUGGING
>     +    {
>     +	/* By now all filehandles should have been closed, so any
>     +	 * stray (non-STD-)filehandles indicate *possible* (PerlIO)
>     +	 * errors. */
>     +	int i;
>     +	for (i = 3; i < PL_perlio_fd_refcnt_size; i++) {
>     +	    if (PL_perlio_fd_refcnt[i])
>     +		PerlIO_debug("PerlIO_cleanup: fd %d refcnt=%d\n",
>     +			     i, PL_perlio_fd_refcnt[i]);
>     +	}
>     +    }
>     +#endif
> 
> perlembed.pod is silent about whether PERL_SYS_TERM needs a context,
> but at least one example shows it used in a function where there isn't a
> my_perl variable defined, so I think requiring a context is a bug.
> 
> Jarkko, is there any reason why PerlIO_teardown needs an aTHX?
> As far as I can see none of its body uses my_perl.
> 
> 
> --
> In England there is a special word which means the last sunshine
> of the summer. That word is "spring".


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.