The following reply was made to PR mod_jserv/5755; it has been noted by GNATS.

From: Vladislav Malyshkin <[EMAIL PROTECTED]>
To: Ed Korthof <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Cc:  
Subject: Re: mod_jserv/5755: mod_jserv and httpd -HUP restarting problem
Date: Tue, 15 Feb 2000 12:01:39 -0500

 Hi Ed,
 There is another strange thing with jserw wrapper,
 how it apache sets signal handlers.
 For debugging I added printing to int wrapper_destroy(wrapper_config *cfg)
   jserv_error(JSERV_LOG_INFO,wrapper_data->config,
        "WRAPPER_DESTROY CALLED WRAPPER PID=%d",
        wrapper_pid);
 I start httpd, httpd starts wrapper,
 and I do
 kill -TERM wrapper_process_number
 I see messages in log that everything is processed fine.
 
 [Tue Feb 15 11:33:15 2000] [info] JServ: WRAPPER_DESTROY CALLED WRAPPER 
PID=19316
 [Tue Feb 15 11:33:15 2000] [info] JServ: Apache Module was cleaned-up
 [Tue Feb 15 11:33:15 2000] [notice] Digest: generating secret for digest 
authentication ...
 [Tue Feb 15 11:33:15 2000] [notice] Digest: done
 [Tue Feb 15 11:33:15 2000] [info] created shared memory segment #11393
 [Tue Feb 15 11:33:15 2000] [notice] Apache/1.3.11 (Unix) ApacheJServ/1.1 
configured -- resuming normal operations
 [Tue Feb 15 11:33:15 2000] [info] Server built: Feb 15 2000 11:13:18
 [Tue Feb 15 11:33:18 2000] [info] JServ: wrapper classpath: 
/home/apache/installation/libexec/ApacheJServ.jar:/home/apache/sources/JSDK2.0/lib/jsdk.jar:/home/apache/sources/mm.mysql.jdbc/mysql_uncomp.jar
 [Tue Feb 15 11:33:18 2000] [info] JServ: wrapper: Java VM spawned (PID=19324, 
PPID=19318)
 [Tue Feb 15 11:33:28 2000] [info] JServ: wrapper: watching processes 
(PID=19318,PPID=19317,JVM PID=19324)
 
 here I do kill -TERM 19318 command
 
 [Tue Feb 15 11:34:03 2000] [info] JServ: WRAPPER SHUTDOWN CALLED PID=19318 
SIGNAL=15
 [Tue Feb 15 11:34:03 2000] [info] JServ: Wrapper: Shutting down JServ 
(PID=19318) (sig 15) JVM pid=19324
 [Tue Feb 15 11:34:03 2000] [info] JServ: wrapper: Terminating JServ 
(PID=19318, VM PID=19324)
 [Tue Feb 15 11:34:03 2000] [info] JServ: ajp12: sending shutdown signal
 
 Then I do same thing, but with -HUP process kill -HUP wrapper_process_number
 
 [Tue Feb 15 11:36:15 2000] [info] JServ: WRAPPER_DESTROY CALLED WRAPPER 
PID=19366
 [Tue Feb 15 11:36:15 2000] [info] JServ: Apache Module was cleaned-up
 [Tue Feb 15 11:36:15 2000] [notice] Digest: generating secret for digest 
authentication ...
 [Tue Feb 15 11:36:15 2000] [notice] Digest: done
 [Tue Feb 15 11:36:15 2000] [info] created shared memory segment #11521
 [Tue Feb 15 11:36:15 2000] [notice] Apache/1.3.11 (Unix) ApacheJServ/1.1 
configured -- resuming normal operations
 [Tue Feb 15 11:36:15 2000] [info] Server built: Feb 15 2000 11:13:18
 [Tue Feb 15 11:36:18 2000] [info] JServ: wrapper classpath: 
/home/apache/installation/libexec/ApacheJServ.jar:/home/apache/sources/JSDK2.0/lib/jsdk.jar:/home/apache/sources/mm.mysql.jdbc/mysql_uncomp.jar
 [Tue Feb 15 11:36:18 2000] [info] JServ: wrapper: Java VM spawned (PID=19374, 
PPID=19368)
 [Tue Feb 15 11:36:28 2000] [info] JServ: wrapper: watching processes 
(PID=19368,PPID=19367,JVM PID=19374)
 
 kill -HUP 19368
 
 and nothing in log. The process is just killed
 It should print at least
  "WRAPPER_DESTROY CALLED WRAPPER PID=%d",
 which I added to wrapper_destroy.
 But as you wrote to me before -HUP signal is handled by apache.
 wrapper_detroy is called on process cleanup?
 
 Is everything fine with ap_register_cleanup in mod_jserv?
 May be I am wrong, but what I see the -HUP signal
 is not handled and cleanup routines of jserv_ module are never called.
 (at least with wrapper_destroy this is definitely the case.
  It should be called by wrapper_cleanup)
 
 Vladislav
 
 Ed Korthof wrote:
 
 > On Tue, 15 Feb 2000, Vladislav Malyshkin wrote:
 >
 > > > Apache sets up its own signal handler for SIGHUP -- and I'm a little
 > > > hesitant to mess with that.  When that handler recieved a SIGHUP, it
 > > > starts the standard Apache cleanup -- I don't think this cleanup is 
 > > > needed
 > > > or even appropriate w/in the wrapper process (which isn't like a normal
 > > > httpd child)
 > >
 > > I think that wrapper needs this cleanup function and first thing which 
 > > wrapper must do
 > > on cleanup is to stop JVM. Otherwise you may easily get a runaway JVM
 > > which will create a serious problem:
 > > the only way to start new apache process will be to kill runaway JVM 
 > > manually
 > > and then start apache.
 > > So I think instead of adding SIGHUP handler it will be better to implement
 > > this cleanup function which will call
 > > wrapper_shutdown(0);
 >
 > grep for 'ap_register_cleanup' within the c source files (particularly
 > mod_jserv.c).  Unfortunately, you'll have to follow several layers of
 > indirection, but this eventually leads to a call to wrapper_destroy, which
 > (under Unix) issues a SIGTERM to the watcher process.
 >
 > Hmm.  Actually, looking at that again -- I guess you're right that the
 > wrapper process should never recieve SIGHUP -- which is exactly what
 > happens when you use killall.  It gets SIGTERM through the cleanup process
 > in the parent httpd ... so my diagrams were bogus.
 >
 > But I'll stand by my statement that using killall is simply broken, and
 > not (imnsho) worth working around.
 >
 > good luck --
 >
 > Ed
 > --
 > See you at ApacheCon 2000 in Orlanda, Florida, March 8-10, 2000.
 >                  http://www.Apachecon.com/
 

Reply via email to