Re: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread Jon Wingfield

Yep. It's a FAQ, but not in the FAQ.

Tomcat not quitting generally means your webapp has started a non-daemon 
thread which does not exit when the webapp is destroyed. If so, shut 
them down in a ServletContextListener.


If you aren't explicitly creating threads in your webapp then the usual 
culprits are database connections that haven't been closed (or any other 
client api to remote services that uses asynchronous messaging and/or 
keepalive semantics).


To see a dump of the threads still active after you've run shutdown.bat 
do a CTRL-BREAK in the tomcat dos console.


HTH,

Jon

Charles Fineman wrote:

I started Tomcat using startup.bat. Everything goes fine. I use
shutdown.batto bring it down. The server fields the request and shuts
down a bunch of
services (as evidenced by the messages I see). Sure enough, the server no
longer responds to any requests. Unfortunately, the java process does not
die.

I have this problem whether I start Tomcat by hand or if I use the Sysdeo
Eclipse plugin.

This problem has been a thorn in my side for some time but since it only
affects my development environment (we use it as a service in production and
there are no problems) and I can kill the process by hand, I've not worried
about it. It's annoying as heck though and I'm wondering if someone can shed
some light.

I searched around but (surprisingly!!) I didn't find anything similar to my
situation.





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread David Delbecq
May i mention also the use of *java.util.Timer in forms other than
new **java.util.Timer*(true);

If used in any other form, it silently creates a non daemon thread.

Jon Wingfield a écrit :

 Yep. It's a FAQ, but not in the FAQ.

 Tomcat not quitting generally means your webapp has started a
 non-daemon thread which does not exit when the webapp is destroyed. If
 so, shut them down in a ServletContextListener.

 If you aren't explicitly creating threads in your webapp then the
 usual culprits are database connections that haven't been closed (or
 any other client api to remote services that uses asynchronous
 messaging and/or keepalive semantics).

 To see a dump of the threads still active after you've run
 shutdown.bat do a CTRL-BREAK in the tomcat dos console.

 HTH,

 Jon

 Charles Fineman wrote:

 I started Tomcat using startup.bat. Everything goes fine. I use
 shutdown.batto bring it down. The server fields the request and shuts
 down a bunch of
 services (as evidenced by the messages I see). Sure enough, the
 server no
 longer responds to any requests. Unfortunately, the java process does
 not
 die.

 I have this problem whether I start Tomcat by hand or if I use the
 Sysdeo
 Eclipse plugin.

 This problem has been a thorn in my side for some time but since it only
 affects my development environment (we use it as a service in
 production and
 there are no problems) and I can kill the process by hand, I've not
 worried
 about it. It's annoying as heck though and I'm wondering if someone
 can shed
 some light.

 I searched around but (surprisingly!!) I didn't find anything similar
 to my
 situation.




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread Larry Meadors
So, once you know the threads that are left, what is the cleanest way
to kill them?

I have had this problem too, but since it was on a *nix platform, and
just used 'kill' to get rid of the parent process.

Larry


On 10/3/05, Jon Wingfield [EMAIL PROTECTED] wrote:
 Yep. It's a FAQ, but not in the FAQ.

 Tomcat not quitting generally means your webapp has started a non-daemon
 thread which does not exit when the webapp is destroyed. If so, shut
 them down in a ServletContextListener.

 If you aren't explicitly creating threads in your webapp then the usual
 culprits are database connections that haven't been closed (or any other
 client api to remote services that uses asynchronous messaging and/or
 keepalive semantics).

 To see a dump of the threads still active after you've run shutdown.bat
 do a CTRL-BREAK in the tomcat dos console.

 HTH,

 Jon

 Charles Fineman wrote:
  I started Tomcat using startup.bat. Everything goes fine. I use
  shutdown.batto bring it down. The server fields the request and shuts
  down a bunch of
  services (as evidenced by the messages I see). Sure enough, the server no
  longer responds to any requests. Unfortunately, the java process does not
  die.
 
  I have this problem whether I start Tomcat by hand or if I use the Sysdeo
  Eclipse plugin.
 
  This problem has been a thorn in my side for some time but since it only
  affects my development environment (we use it as a service in production and
  there are no problems) and I can kill the process by hand, I've not worried
  about it. It's annoying as heck though and I'm wondering if someone can shed
  some light.
 
  I searched around but (surprisingly!!) I didn't find anything similar to my
  situation.
 



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread David Delbecq
That's quite a problem ;)
Actually  your threads should be coded in such a way
you may a send a notification in java telling him to finish his job.

eg:

myNonDaemonThreadICreatedMySelf.stopWorking();
which would set some flag in Thread and then code in your
Thread reading the flag knows it has to stop in a clean way.

In the past there was a way in java to 'kill' a Thread but this has
been deprecated in the Thread api. Tomcat sends a ThreadDeathError
to the thread if it tries to interact with its classloader after shutdown,
unfortunately, this is not always enough has some Threads do a
catch(Error) and then continue their job.

The best thing you can do when you have the list of threads still alive
after shutdown is to locate the irresponsible threads and fix their code :D



Larry Meadors a écrit :

So, once you know the threads that are left, what is the cleanest way
to kill them?

I have had this problem too, but since it was on a *nix platform, and
just used 'kill' to get rid of the parent process.

Larry


On 10/3/05, Jon Wingfield [EMAIL PROTECTED] wrote:
  

Yep. It's a FAQ, but not in the FAQ.

Tomcat not quitting generally means your webapp has started a non-daemon
thread which does not exit when the webapp is destroyed. If so, shut
them down in a ServletContextListener.

If you aren't explicitly creating threads in your webapp then the usual
culprits are database connections that haven't been closed (or any other
client api to remote services that uses asynchronous messaging and/or
keepalive semantics).

To see a dump of the threads still active after you've run shutdown.bat
do a CTRL-BREAK in the tomcat dos console.

HTH,

Jon

Charles Fineman wrote:


I started Tomcat using startup.bat. Everything goes fine. I use
shutdown.batto bring it down. The server fields the request and shuts
down a bunch of
services (as evidenced by the messages I see). Sure enough, the server no
longer responds to any requests. Unfortunately, the java process does not
die.

I have this problem whether I start Tomcat by hand or if I use the Sysdeo
Eclipse plugin.

This problem has been a thorn in my side for some time but since it only
affects my development environment (we use it as a service in production and
there are no problems) and I can kill the process by hand, I've not worried
about it. It's annoying as heck though and I'm wondering if someone can shed
some light.

I searched around but (surprisingly!!) I didn't find anything similar to my
situation.

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread Larry Meadors
Heh, I'll call IBM and have them do just that. ;-)

It happens in their JT400 classes.

Larry


On 10/3/05, David Delbecq [EMAIL PROTECTED] wrote:
 That's quite a problem ;)
 Actually  your threads should be coded in such a way
 you may a send a notification in java telling him to finish his job.

 eg:

 myNonDaemonThreadICreatedMySelf.stopWorking();
 which would set some flag in Thread and then code in your
 Thread reading the flag knows it has to stop in a clean way.

 In the past there was a way in java to 'kill' a Thread but this has
 been deprecated in the Thread api. Tomcat sends a ThreadDeathError
 to the thread if it tries to interact with its classloader after shutdown,
 unfortunately, this is not always enough has some Threads do a
 catch(Error) and then continue their job.

 The best thing you can do when you have the list of threads still alive
 after shutdown is to locate the irresponsible threads and fix their code :D



 Larry Meadors a écrit :

 So, once you know the threads that are left, what is the cleanest way
 to kill them?
 
 I have had this problem too, but since it was on a *nix platform, and
 just used 'kill' to get rid of the parent process.
 
 Larry
 
 
 On 10/3/05, Jon Wingfield [EMAIL PROTECTED] wrote:
 
 
 Yep. It's a FAQ, but not in the FAQ.
 
 Tomcat not quitting generally means your webapp has started a non-daemon
 thread which does not exit when the webapp is destroyed. If so, shut
 them down in a ServletContextListener.
 
 If you aren't explicitly creating threads in your webapp then the usual
 culprits are database connections that haven't been closed (or any other
 client api to remote services that uses asynchronous messaging and/or
 keepalive semantics).
 
 To see a dump of the threads still active after you've run shutdown.bat
 do a CTRL-BREAK in the tomcat dos console.
 
 HTH,
 
 Jon
 
 Charles Fineman wrote:
 
 
 I started Tomcat using startup.bat. Everything goes fine. I use
 shutdown.batto bring it down. The server fields the request and shuts
 down a bunch of
 services (as evidenced by the messages I see). Sure enough, the server no
 longer responds to any requests. Unfortunately, the java process does not
 die.
 
 I have this problem whether I start Tomcat by hand or if I use the Sysdeo
 Eclipse plugin.
 
 This problem has been a thorn in my side for some time but since it only
 affects my development environment (we use it as a service in production 
 and
 there are no problems) and I can kill the process by hand, I've not worried
 about it. It's annoying as heck though and I'm wondering if someone can 
 shed
 some light.
 
 I searched around but (surprisingly!!) I didn't find anything similar to my
 situation.
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread Phillip Qin
Why bother IBM. In my startup script, I clean up any java process:

for i in `ps ax --format ppid,pid,cmd |grep java |egrep
^[[:space:]]*1[[:space:]] |tr -s ' ' |cut -f3 -d `
do
echo killing $i...
kill -9 $i
done

-Original Message-
From: Larry Meadors [mailto:[EMAIL PROTECTED] 
Sent: October 3, 2005 8:09 AM
To: Tomcat Users List
Subject: Re: FAQ? shutdown.bat not killing java process on Windows

Heh, I'll call IBM and have them do just that. ;-)

It happens in their JT400 classes.

Larry


On 10/3/05, David Delbecq [EMAIL PROTECTED] wrote:
 That's quite a problem ;)
 Actually  your threads should be coded in such a way
 you may a send a notification in java telling him to finish his job.

 eg:

 myNonDaemonThreadICreatedMySelf.stopWorking();
 which would set some flag in Thread and then code in your
 Thread reading the flag knows it has to stop in a clean way.

 In the past there was a way in java to 'kill' a Thread but this has
 been deprecated in the Thread api. Tomcat sends a ThreadDeathError
 to the thread if it tries to interact with its classloader after shutdown,
 unfortunately, this is not always enough has some Threads do a
 catch(Error) and then continue their job.

 The best thing you can do when you have the list of threads still alive
 after shutdown is to locate the irresponsible threads and fix their code
:D



 Larry Meadors a écrit :

 So, once you know the threads that are left, what is the cleanest way
 to kill them?
 
 I have had this problem too, but since it was on a *nix platform, and
 just used 'kill' to get rid of the parent process.
 
 Larry
 
 
 On 10/3/05, Jon Wingfield [EMAIL PROTECTED] wrote:
 
 
 Yep. It's a FAQ, but not in the FAQ.
 
 Tomcat not quitting generally means your webapp has started a non-daemon
 thread which does not exit when the webapp is destroyed. If so, shut
 them down in a ServletContextListener.
 
 If you aren't explicitly creating threads in your webapp then the usual
 culprits are database connections that haven't been closed (or any other
 client api to remote services that uses asynchronous messaging and/or
 keepalive semantics).
 
 To see a dump of the threads still active after you've run shutdown.bat
 do a CTRL-BREAK in the tomcat dos console.
 
 HTH,
 
 Jon
 
 Charles Fineman wrote:
 
 
 I started Tomcat using startup.bat. Everything goes fine. I use
 shutdown.batto bring it down. The server fields the request and shuts
 down a bunch of
 services (as evidenced by the messages I see). Sure enough, the server
no
 longer responds to any requests. Unfortunately, the java process does
not
 die.
 
 I have this problem whether I start Tomcat by hand or if I use the
Sysdeo
 Eclipse plugin.
 
 This problem has been a thorn in my side for some time but since it
only
 affects my development environment (we use it as a service in
production and
 there are no problems) and I can kill the process by hand, I've not
worried
 about it. It's annoying as heck though and I'm wondering if someone can
shed
 some light.
 
 I searched around but (surprisingly!!) I didn't find anything similar
to my
 situation.
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:43411f6a315711908041642!


Re: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread Charles Fineman
Thanks (to all). I had suspected this but all of the threads that were left
over (used eclipse) seemed like system threads. Turns out the culprit was an
RMI server object that was being exported by the webapp (you can browbeat me
over that in a different thread... I kept it for backwards compatibility).

At any rate, it turns out that Sun's RMI Distributed GC timer thread was
getting created as a non-daemon thread. There is, as you might expect, no
way to make this a daemon thread however I was able to unexport the Remote
object (indirectly of course :-) when the webapp get's shutdown.

This raises a question in my mind about the right way to do something in
tomcat/jws. I use a manager servlet that has an init (and now a destroy)
method to setup (tear down) resources for a webapp. I did it this way
because I wanted non-lazy initialization of the webapp's resources (i.e.
rather than waiting for the init method of one of the other servlets to be
called). I set the load-on-startup attribute to zero to ensure these get
loaded as soon as the webapp is loaded.

Is there another mechanism I ought to be using to initialize (arbitrary)
resources for my webapp?

On 10/3/05, Jon Wingfield [EMAIL PROTECTED] wrote:

 Yep. It's a FAQ, but not in the FAQ.

 Tomcat not quitting generally means your webapp has started a non-daemon
 thread which does not exit when the webapp is destroyed. If so, shut
 them down in a ServletContextListener.

 If you aren't explicitly creating threads in your webapp then the usual
 culprits are database connections that haven't been closed (or any other
 client api to remote services that uses asynchronous messaging and/or
 keepalive semantics).

 To see a dump of the threads still active after you've run shutdown.bat
 do a CTRL-BREAK in the tomcat dos console.

 HTH,

 Jon

 Charles Fineman wrote:
  I started Tomcat using startup.bat. Everything goes fine. I use
  shutdown.batto bring it down. The server fields the request and shuts
  down a bunch of
  services (as evidenced by the messages I see). Sure enough, the server
 no
  longer responds to any requests. Unfortunately, the java process does
 not
  die.
 
  I have this problem whether I start Tomcat by hand or if I use the
 Sysdeo
  Eclipse plugin.
 
  This problem has been a thorn in my side for some time but since it only
  affects my development environment (we use it as a service in production
 and
  there are no problems) and I can kill the process by hand, I've not
 worried
  about it. It's annoying as heck though and I'm wondering if someone can
 shed
  some light.
 
  I searched around but (surprisingly!!) I didn't find anything similar to
 my
  situation.
 



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




RE: FAQ? shutdown.bat not killing java process on Windows

2005-10-03 Thread Caldarale, Charles R
 From: Charles Fineman [mailto:[EMAIL PROTECTED] 
 Subject: Re: FAQ? shutdown.bat not killing java process on Windows
 
 Is there another mechanism I ought to be using to initialize 
 (arbitrary) resources for my webapp?

A context listener might be what you're looking for.  See the Lifecycle
Listeners section of:
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]