httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@opengroup.org>
Subject Re: mod_perl and exit
Date Mon, 04 Aug 1997 02:55:25 GMT
Alexei Kosut <akosut@organic.com> wrote:

> On Sat, 2 Aug 1997, Doug MacEachern wrote:
> 
> > why I put this off for so long.  Two, and more import, now that I can
> > jump out of a callback and maintain Perl interpreter sanity, how
> > should I terminate the child process?  Is there a need for some kind
> > of child_done() routine?  Or a new handler return code, say
> > `TERMINATE' which tells httpd to finish up logging, protocol,
> > child_exit, etc.?  I know I could hack something together that would
> 
> I don't think something exists. You'd want something that works on a
> per-request level, so Perl wouldn't ever get run again, wheras everyhting
> we have (max_requests_per_child, etc...) works on a per-commection
> level. You'd have to tag something to break out of the process_request
> while() loop, and then exit.
> 
> One thing you could do without adding new code (and that would work with
> existing Apaches) would be to put this at the end of the handler
> function:
> 
> r->connection->keepalive = 0;
> requests_this_child = max_requests_per_child
> 
> Although that does involve doing things that aren't quite kosher (and
> assuming max_requests_per_child > 0), it should work.
> 
> I agree it would be best to add a function to do that, though.

okay, how about adding this as child_terminate() then?  

-Doug

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.195
diff -u -C3 -r1.195 http_main.c
/usr/bin/diff: conflicting specifications of output style
*** http_main.c	1997/08/03 20:37:18	1.195
--- http_main.c	1997/08/04 02:48:53
***************
*** 3221,3226 ****
--- 3221,3231 ----
      (void)update_child_status(child_num,SERVER_DEAD, NULL);
  }
  
+ API_EXPORT(void) child_terminate (request_rec *r)
+ {
+     r->connection->keepalive = 0;
+     requests_this_child = max_requests_per_child;
+ }
  
  void
  child_main(int child_num_arg)
Index: http_main.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.h,v
retrieving revision 1.16
diff -u -C3 -r1.16 http_main.h
/usr/bin/diff: conflicting specifications of output style
*** http_main.h	1997/07/21 05:53:46	1.16
--- http_main.h	1997/08/04 02:48:53
***************
*** 96,98 ****
--- 96,99 ----
  void time_process_request (int child_num, int status);
  unsigned int set_callback_and_alarm(void (*fn)(int), int x);
  int check_alarm(void);
+ API_EXPORT(void) child_terminate (void);


Mime
View raw message