tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: problems starting/stopping tomcat
Date Mon, 15 Sep 2003 17:38:27 GMT

Howdy,
The general answer is, if you use a 3rd party library (in java, or c, or
whatever), it is your responsibility to ensure that library shuts down
properly.  The container can't do that for you.

In this specific case, how are you invoking the c library?  

If you can change the library's code so that it always returns/quits
after a certain timeout, that's good.

Alternatively, if you invoke the library in a separate thread, keep a
handle to the thread, and interrupt it so that it returns from its run()
method when you're shutting down.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Astrid Wagner [mailto:Astrid.Wagner@motorola.com]
>Sent: Monday, September 15, 2003 1:30 PM
>To: Tomcat Users List
>Subject: Re: problems starting/stopping tomcat
>
>Hi,
>
>I killed some processes related to native c calls I submit and now I
can
>start/stop TC so this
> time it could have been some non-terminated processes (due to network
>problem).
>The question now is: I may have some situations like that e.g due to a
>network problem
>a native call can not be finished etc. How do I avoid running into such
>severe problems:
>do I have to implement sth. like a timeout in the c programm to
>guarantee it will
>quit  ?!
>Thanks for your help.
>
>Astrid
>
>Astrid Wagner wrote:
>
>> Thanks for the quick response.
>>
>> Shapira, Yoav wrote:
>>
>>> Howdy,
>>> Several things to do:
>>>
>>> Try to start tomcat from the console (use catalina.sh run instead of
>>> catalina.sh start) and when you run into this condition again, use
>>> CTRL-BREAK to send a SIGQUIT to the JVM so that you can an output of
>>> what your threads are doing.
>>>
>> I ran "catalina.sh run" and run into this condition over and over.
>> I do not know when/how I should terminate it since it prints out the
>> message and finishes itself quickly. Should I look for java thread
>> processes?
>>
>>>
>>> Don't start non-daemon threads in your webapp.  Alternatively, if
you
>>> do, make sure they properly handle interruptions and quit.  If
you're
>>> not sure where they're coming from, do the above SIGQUIT approach to
>>> see.
>>
>> I am not aware of non-deamon threads. Maybe the problem has sth. to
do
>> with native calls
>> I use but they are terminated I guess ...
>> Thanks
>> Astrid
>>
>>>
>>> As another alternative, though dirty and potentially very bad if
>>
>> there's
>>
>>> more than one webapp on the server: write a ServletContextListener
that
>>> does System.exit(n) at the end of its contextDestroyed method ;)
>>>
>>> Yoav Shapira
>>> Millennium ChemInformatics
>>>
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Astrid Wagner [mailto:Astrid.Wagner@motorola.com]
>>>> Sent: Monday, September 15, 2003 12:56 PM
>>>> To: Tomcat Users List
>>>> Subject: Re: problems starting/stopping tomcat
>>>>
>>>> Hi,
>>>>
>>>> Not again !!
>>>> I ran into the same problem:
>>>> SEVERE: Error initializing endpoint
>>>> java.net.BindException: Address already in use:8080
>>>>       at
>>>>
org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoin
>>>
>> t
>>
>>>>
>>>
>>> .jav
>>>
>>>
>>>> a:280)
>>>>       at
>>>>
org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:150)
>>>>       at
>>>>
org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.j
>>>
>> a
>>
>>>>
>>>
>>> va:1
>>>
>>>
>>>> 117)
>>>>       at
>>>>
org.apache.catalina.core.StandardService.initialize(StandardService.ja
>>>
>> v
>>
>>>>
>>>
>>> a:57
>>>
>>>
>>>> 9)
>>>>       at
>>>>
org.apache.catalina.core.StandardServer.initialize(StandardServer.java
>>>
>> :
>>
>>>>
>>>
>>> 2246
>>>
>>>
>>>> )
>>>>
>>>> not being able to get a clean state.
>>>> Can you tell me how to look for status of ports and how I can kill
>>>>
>>>
>>> those
>>>
>>>
>>>> processes
>>>> keeping thoses port occupied because I can not see tomcat process.
>>>> netstat | grep 8080
>>>> returns nothing (I get sth. for 8005) but that is not why it
fails??!
>>>> I do not want to boot everytime I run into that problem ..
>>>> Thanks Astrid
>>>>
>>>>
>>>> Shapira, Yoav wrote:
>>>>
>>>>
>>>>
>>>>> Howdy,
>>>>> I'm glad you're OK for now ;)
>>>>>
>>>>> Tomcat shuts down properly under normal circumstances.  The only
>>>>
>> times
>>
>>>>> when it doesn't is when webapps start non-daemon threads and don't
>>>>> terminate them properly.  Sometimes your webapp doesn't do this
>>>>>
>>>>
>>> directly
>>>
>>>
>>>>> but a 3rd party library used by your webapp does.
>>>>>
>>>>> Yoav Shapira
>>>>> Millennium ChemInformatics
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Astrid Wagner [mailto:Astrid.Wagner@motorola.com]
>>>>>> Sent: Monday, September 15, 2003 9:08 AM
>>>>>> To: Tomcat Users List
>>>>>> Subject: Re: problems starting/stopping tomcat
>>>>>>
>>>>>> Thanks. We rebooted the machine and until now (I keep my fingers
>>>>>> crossed) it works again.
>>>>>> Tomcat must have not shut down properly leaving me in a deadlock.
>>>>>> Astrid
>>>>>>
>>>>>> Shapira, Yoav wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Howdy,
>>>>>>> Use netstat to see the status of ports.
>>>>>>>
>>>>>>> Tomcat uses at least two ports at runtime: the SHUTDOWN port
(8005
>>>>>>>
>>>>>>
>>> by
>>>
>>>
>>>>>>> default) and the actual user connector ports (8080 and 8009 by
>>>>>>>
>>>>>>
>>> default
>>>
>>>
>>>>>>> for tomcat 4.1.x).
>>>>>>>
>>>>>>> What likely happened was:
>>>>>>> - Your first tomcat instance (ports 8005 and 8080) did not shut
>>>>>>
>> down
>>
>>>>>>> properly,  most likely because you had non-daemon threads still
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>> running
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>> - When you changed to port 8081 and tried to start, you got the
>>>>>>>
>>>>>>
>>> error
>>>
>>>
>>>>>>> because tomcat was still listening on port 8005 for shutdown.
You
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>> need
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>> to change both ports, or better yet, fix the cause for tomcat
not
>>>>>>> shutting down properly ;)
>>>>>>>
>>>>>>> Yoav Shapira
>>>>>>> Millennium ChemInformatics
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Astrid Wagner [mailto:Astrid.Wagner@motorola.com]
>>>>>>>> Sent: Saturday, September 13, 2003 4:33 AM
>>>>>>>> To: tomcat-user@jakarta.apache.org
>>>>>>>> Subject: problems starting/stopping tomcat
>>>>>>>>
>>>>>>>> Hi ,
>>>>>>>> I use tomcat 4.1.24, jdk 1.4.0 and Apache 1.3 on Solaris
8.
>>>>>>>> After having developed and successfully run many servlets
I now
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>> receive
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>> a "port 8080 already in use problem" after I try to start
tomcat.
>>>>>>>>
>>>>>>>> Sep 13, 2003 10:20:54 AM org.apache.commons.modeler.Registry
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> loadRegistry
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> INFO: Loading registry information
>>>>>>>> Sep 13, 2003 10:20:54 AM org.apache.commons.modeler.Registry
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> getRegistry
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> INFO: Creating new Registry instance
>>>>>>>> Sep 13, 2003 10:20:57 AM org.apache.commons.modeler.Registry
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>> getServer
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>> INFO: Creating MBeanServer
>>>>>>>> Sep 13, 2003 10:21:00 AM
org.apache.coyote.http11.Http11Protocol
>>>>>>>>
>>>>>>>
>>> init
>>>
>>>
>>>>>>>> SEVERE: Error initializing endpoint
>>>>>>>> java.net.BindException: Address already in use:8080
>>>>>>>>     at
>>>>>>>>
org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEnd
>>>>>>>
>> p
>>
>>>>>>>>
>>>>>>>
>>> oi
>>>
>>>
>>>>>>>>
>>>>>>>
>>>>> nt
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> .jav
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> a:280
>>>>>>>> )
>>>>>>>>     at
>>>>>>>>
org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:1
>>>>>>>
>> 5
>>
>>>>>>>>
>>>>>>>
>>> 0)
>>>
>>>
>>>>>>>> I did not change any configuration and I do not think that
the
>>>>>>>>
>>>>>>>
>>> ports
>>>
>>>
>>>>>>>> are in use by any other processes (Apache uses a different
port).
>>>>>>>> Could it be that while doing shutdown-startup sequences a
process
>>>>>>>> has been left hanging (?).
>>>>>>>> When I replaced port 8080 by 8081 I was able to start tomcat
but
>>>>>>>>
>>>>>>>
>>> when
>>>
>>>
>>>>>>>>
>>>>>>>
>>>>> I
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>> called a servlet it said "8005" (port for shutdown) in use
?!
>>>>>>>> When I replaced also 8005 for test purposes the servlet hangs
and
>>>>>>>
>> I
>>
>>>>>>>> could not see any error being logged (catalina.out, web appl
log
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>> files,
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>> Apache log ...).
>>>>>>>>
>>>>>>>> My question: how do I get more info about what ports tomcat
still
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>> uses
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>> for what ?
>>>>>>>> Any hint would be appreciated.
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> Astrid
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> This e-mail, including any attachments, is a confidential
business
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> communication, and may contain information that is confidential,
>>>>>> proprietary and/or privileged.  This e-mail is intended only for
the
>>>>>> individual(s) to whom it is addressed, and may not be saved,
copied,
>>>>>> printed, disclosed or used by anyone else.  If you are not
the(an)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> intended
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> recipient, please immediately delete this e-mail from your
computer
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> system
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> and notify the sender.  Thank you.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
-------------------------------------------------------------------
>>>>>>
>> -
>>
>>>>>>>
>>>>>>
>>> -
>>>
>>>
>>>>>>> To unsubscribe, e-mail:
tomcat-user-unsubscribe@jakarta.apache.org
>>>>>>> For additional commands, e-mail:
>>>>>>
>> tomcat-user-help@jakarta.apache.org
>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> This e-mail, including any attachments, is a confidential business
>>>>>
>>>>
>>>> communication, and may contain information that is confidential,
>>>> proprietary and/or privileged.  This e-mail is intended only for
the
>>>> individual(s) to whom it is addressed, and may not be saved,
copied,
>>>> printed, disclosed or used by anyone else.  If you are not the(an)
>>>>
>>>
>>> intended
>>>
>>>
>>>> recipient, please immediately delete this e-mail from your computer
>>>>
>>>
>>> system
>>>
>>>
>>>> and notify the sender.  Thank you.
>>>>
>>>>
>>>>>
---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>>
>>> This e-mail, including any attachments, is a confidential business
>>
>> communication, and may contain information that is confidential,
>> proprietary and/or privileged.  This e-mail is intended only for the
>> individual(s) to whom it is addressed, and may not be saved, copied,
>> printed, disclosed or used by anyone else.  If you are not the(an)
>> intended recipient, please immediately delete this e-mail from your
>> computer system and notify the sender.  Thank you.
>>
>>>
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


Mime
View raw message