This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 113410 - Cannot reliably stop Tomcat
Summary: Cannot reliably stop Tomcat
Status: RESOLVED INVALID
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-21 19:05 UTC by _ gsporar
Modified: 2007-09-18 22:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
message log file (58.06 KB, text/plain)
2007-08-21 19:06 UTC, _ gsporar
Details
IDE's message log file (88.59 KB, text/plain)
2007-08-22 17:08 UTC, _ gsporar
Details
Tomcat log files (2.01 KB, application/octet-stream)
2007-08-22 17:21 UTC, _ gsporar
Details
thread dump - stopping tomcat (10.45 KB, text/plain)
2007-09-18 17:22 UTC, Petr Hejl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ gsporar 2007-08-21 19:05:26 UTC
Running the daily build from 2007-08-21 on Ubuntu 7.04 with JDK6u2

I used the entry for Tomcat that is in the Services window to start Tomcat. That worked fine.  Then I used it again to
try to stop Tomcat.  The IDE timed out and eventually reported that it was unable to stop Tomcat.

Using jps, however, it appears that Tomcat is no longer running.  So Tomcat did apparently get stopped (I have seen this
happen before with this build, however, and Tomcat did *not* get stopped).

I will attach my message log.

Are there any logging messages that I could turn on to get additional information?
Comment 1 _ gsporar 2007-08-21 19:06:30 UTC
Created attachment 46998 [details]
message log file
Comment 2 Sherold Dev 2007-08-22 15:43:32 UTC
I can't reproduce the issue. Marking as INCOMPLETE.

1) Can you please attach Tomcat server output and server log?
2) Is the issue always reproducible?
3) What is deployed on the server?

In order to enabled debug logging just start NetBeans with the following parameter:

-J-Dorg.netbeans.modules.tomcat5.level=0
Comment 3 _ gsporar 2007-08-22 17:07:42 UTC
This is, unfortunately, not consistently reproducible.

I tried just now to start and stop Tomcat a few times with no applications deployed. It worked perfectly each time.

Then I deployed the Roller web log engine (you can get the project from here:
http://wiki.netbeans.org/wiki/view/RollerCaseStudy, with complete setup instructions) and was able to reproduce the problem.

I started Tomcat by right-clicking the Roller project and choosing Run.

After Tomcat started I went to the Resources window and shut down Tomcat.  The IDE eventually timed out and reported
that it was unable to stop Tomcat.  Interestingly, it appears that Tomcat is in fact still running.  When I run jps I
see this entry:

12732 Bootstrap

Isn't Bootstrap the name of the main class for Tomcat?

When I try to access localhost:8084 in my browser, however, I get an "Unable to Connect error"....

The Tomcat server output as displayed in the IDE's output window is:

Aug 22, 2007 10:55:12 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the
java.library.path:
/usr/share/jdk1.6.0_02/jre/lib/i386/client:/usr/share/jdk1.6.0_02/jre/lib/i386:/usr/share/jdk1.6.0_02/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
Aug 22, 2007 10:55:12 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
Aug 22, 2007 10:55:12 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 506 ms
Aug 22, 2007 10:55:12 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 22, 2007 10:55:12 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.13
AbandonedObjectPool is used (org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool@1bbd23f)
   LogAbandoned: false
   RemoveAbandoned: true
   RemoveAbandonedTimeout: 300
Aug 22, 2007 10:55:17 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8084
Aug 22, 2007 10:55:17 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 22, 2007 10:55:17 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/52  config=null
Aug 22, 2007 10:55:17 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5371 ms
Aug 22, 2007 10:55:23 AM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8084
Aug 22, 2007 10:55:24 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Aug 22, 2007 10:55:24 AM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8084

I will attach the requested files.

Comment 4 _ gsporar 2007-08-22 17:08:21 UTC
Created attachment 47090 [details]
IDE's message log file
Comment 5 _ gsporar 2007-08-22 17:21:54 UTC
Created attachment 47093 [details]
Tomcat log files
Comment 6 Sherold Dev 2007-08-23 10:06:19 UTC
The application seems to be rather big. So far, it does not seem to me that the problem is in NetBeans.

Based on the provided log files, Tomcat plugin correctly launched 'catalina.sh stop' script and then waited for a few
minutes whether the server shut down or not.

Could you please check whether the same issue occurs when you try to stop Tomcat from the command line? Set the
CATALINA_HOME and CATALINA_BASE environment variables according to the values from the server manager and call
'catalina.sh stop'.

It might be also interesting to see Tomcat thread dump after an unsuccessful attempt to stop the server. Use
'ps -Af | grep Bootstrap' command to find the Tomcat process and then use 'kill -QUIT $PID' to generate a thread dump.
The thread dump should appear in the server output.

Thanks
Comment 7 Petr Hejl 2007-09-18 16:01:04 UTC
Can be reproduced from command line too (with different jvms). It seems that when tomcat is running this application it
performs some other tasks after the start. This tasks (don't know exactly what is happening) probably delays the stop by
almost 5 minutes. When the tomcat is left running for some time and _after_ that the stop is executed it finishes
immediately.
Comment 8 Petr Hejl 2007-09-18 17:22:48 UTC
Created attachment 49003 [details]
thread dump - stopping tomcat
Comment 9 Petr Hejl 2007-09-18 17:34:05 UTC
Tomcat without this application works pretty fine. It is almost certain that the trouble is caused by the application.
Maybe jdbc driver or something similar. Will investigate a bit more, however it is almost certain that this issue will
be closed as invalid.
Comment 10 Petr Hejl 2007-09-18 22:01:19 UTC
The problem is in the user application in class ThreadManagerImpl. It is probably the following code which blocks the
shutdown:

public void shutdown()
{
    backgroundExecutor.shutdownAfterProcessingCurrentlyQueuedTasks();
    scheduler.cancel();
}

When changed to use backgroundExecutor.shutdownNow() tomcat shutdowns immediately.
Definitely not a netbeans issue.