perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@hyperreal.org
Subject cvs commit: modperl/src/modules/perl mod_perl.c mod_perl.h
Date Fri, 18 Sep 1998 21:05:29 GMT
dougm       98/09/18 14:05:29

  Modified:    .        Makefile.PL
               src/modules/perl mod_perl.c mod_perl.h
  Log:
  Gerald's PERL_STARTUP_DONE workaround
  we need to find the *real* problem and fix it.
  if perl_construct..perl_run is being called more than once, we are leaking
  unless perl_shutdown is called, but I cannot reproduce this problem
  
  Revision  Changes    Path
  1.96      +3 -1      modperl/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /export/home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- Makefile.PL	1998/09/17 21:56:46	1.95
  +++ Makefile.PL	1998/09/18 21:05:27	1.96
  @@ -180,6 +180,7 @@
   $PERL_RUN_XS = 0;
   
   my %experimental = map { $_,1 } qw{
  +PERL_STARTUP_DONE_CHECK
   PERL_RUN_XS
   PERL_GET_SET_HANDLERS
   PERL_MARK_WHERE
  @@ -280,7 +281,8 @@
   }
   
   my %very_experimental = map {$_,1} 
  -qw(PERL_DEFAULT_OPMASK PERL_SAFE_STARTUP PERL_ORALL_OPMASK);
  +qw(PERL_DEFAULT_OPMASK PERL_SAFE_STARTUP PERL_ORALL_OPMASK 
  +   PERL_STARTUP_DONE_CHECK);
   
   if($EXPERIMENTAL) {
       for (keys %experimental) {
  
  
  
  1.46      +24 -11    modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- mod_perl.c	1998/09/17 23:07:26	1.45
  +++ mod_perl.c	1998/09/18 21:05:28	1.46
  @@ -407,6 +407,10 @@
   #define mod_perl_tie_scriptname()
   #endif
   
  +#define saveINC \
  +    if(orig_inc) SvREFCNT_dec(orig_inc); \
  +    orig_inc = av_copy_array(GvAV(incgv))
  +
   void perl_startup (server_rec *s, pool *p)
   {
       char *argv[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
  @@ -515,7 +519,6 @@
       MP_TRACE_g(fprintf(stderr, "constructing perl interpreter...ok\n"));
       perl_construct(perl);
   
  -
       status = perl_parse(perl, xs_init, argc, argv, NULL);
       if (status != OK) {
   	MP_TRACE_g(fprintf(stderr,"not ok, status=%d\n", status));
  @@ -563,7 +566,12 @@
       mod_perl_mutex = create_mutex(NULL);
   #endif
   
  -    status = perl_run(perl);
  +    if ((status = perl_run(perl)) != OK) {
  +	MP_TRACE_g(fprintf(stderr,"not ok, status=%d\n", status));
  +	perror("run");
  +	exit(1);
  +    }
  +    MP_TRACE_g(fprintf(stderr, "ok\n"));
   
       {
   	dTHR;
  @@ -580,6 +588,19 @@
   	GvIMPORTED_CV_on(exitgp);
       }
   
  +    if(PERL_STARTUP_DONE_CHECK && !getenv("PERL_STARTUP_DONE")) {
  +	MP_TRACE_g(fprintf(stderr, 
  +			   "mod_perl: PerlModule,PerlRequire postponed\n"));
  +#ifndef WIN32
  +	setenv("PERL_STARTUP_DONE", "1", 1);
  +#else
  +	SetEnvironmentVariable("PERL_STARTUP_DONE", "1");
  +#endif
  +	saveINC;
  +	Apache__ServerStarting(FALSE);
  +	return;
  +    }
  +
       ENTER_SAFE(s,p);
       MP_TRACE_g(mod_perl_dump_opmask());
   
  @@ -592,13 +613,6 @@
   	}
       }
   
  -    if (status != OK) {
  -	MP_TRACE_g(fprintf(stderr,"not ok, status=%d\n", status));
  -	perror("run");
  -	exit(1);
  -    }
  -    MP_TRACE_g(fprintf(stderr, "ok\n"));
  -
       list = (char **)cls->PerlModule->elts;
       for(i = 0; i < cls->PerlModule->nelts; i++) {
   	if(perl_require_module(list[i], s) != OK) {
  @@ -617,9 +631,8 @@
       if(endav)
   	MP_TRACE_g(fprintf(stderr, "mod_perl: cannot run END blocks encoutered at server startup
without apache_1.3.0+\n"));
   #endif
  -
  -    orig_inc = av_copy_array(GvAV(incgv));
   
  +    saveINC;
       Apache__ServerStarting(FALSE);
   }
   
  
  
  
  1.50      +4 -0      modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- mod_perl.h	1998/09/17 23:07:26	1.49
  +++ mod_perl.h	1998/09/18 21:05:28	1.50
  @@ -384,6 +384,10 @@
   #endif
   #endif
   
  +#ifndef PERL_STARTUP_DONE_CHECK
  +#define PERL_STARTUP_DONE_CHECK getenv("PERL_STARTUP_DONE_CHECK")
  +#endif
  +
   #ifdef APACHE_SSL
   #define PERL_DONE_STARTUP 1
   #else
  
  
  

Mime
View raw message