tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kelly Ellis" <fountaingo...@gmail.com>
Subject Tomcat Extremely Slow and High CPU in Debug Mode
Date Fri, 25 Jul 2008 20:40:40 GMT
Hi All,

I've been having a problem for several days now when debugging Tomcat 5.5.26
on my development machine. Only when debugging, Tomcat runs very slow with
high CPU usage. The same does not happen when running Tomcat without
debugging. There is no noticeable difference in memory usage between
debugging and not debugging. I'm working with other developers who have
similar (if not identical) setups, and they haven't experienced these
issues. I am relatively new to Java development, Tomcat, and Eclipse, so
please let me know of any more helpful information I can provide.

When not in debug mode:
- CPU spike at Tomcat startup, which goes all the way back down after a few
seconds.
- Each call in a series of JUnit tests which hit my local instance of Tomcat
takes below 0.15 seconds, most of the time taking below 0.1 seconds. Pages
in the browser load very quickly.
- When I run these tests, there is only a brief (and not as severe) increase
in the CPU usage of the java process, then it immediately goes back down.

When in debug mode, starting Tomcat through Eclipse:
- CPU spikes at startup and stays high for several minutes. During this time
any attempt to stop Tomcat throws a "Connection refused" error.
- The same unit tests that took fractions of a second to run now take around
30 seconds apiece. During this time CPU again seems to go through the roof.
- When I pause the debugger and look at the stack trace (startup and while
hitting code), I see lots of threads with Object.wait. Stack trace while
running a test:

org.apache.catalina.startup.Bootstrap at localhost:50076 (Suspended)
    Daemon System Thread [Finalizer] (Suspended)
        Object.wait(long) line: not available [native method]
        ReferenceQueue<T>.remove(long) line: 116
        ReferenceQueue<T>.remove() line: 132
        Finalizer$FinalizerThread.run() line: 159
    Daemon System Thread [Reference Handler] (Suspended)
        Object.wait(long) line: not available [native method]
        Reference$Lock(Object).wait() line: 474
        Reference$ReferenceHandler.run() line: 116
    Thread [main] (Suspended)
        PlainSocketImpl.socketAccept(SocketImpl) line: not available [native
method]
        SocksSocketImpl(PlainSocketImpl).accept(SocketImpl) line: 384
        ServerSocket.implAccept(Socket) line: 450
        ServerSocket.accept() line: 421
        StandardServer.await() line: 379
        Catalina.await() line: 616
        Catalina.start() line: 576
        NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
        NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
        DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
        Method.invoke(Object, Object...) line: 585
        Bootstrap.start() line: 295
        Bootstrap.main(String[]) line: 433
    Daemon System Thread [Signal Dispatcher] (Suspended)
    Daemon Thread [Thread-1] (Suspended)
        Thread.sleep(long) line: not available [native method]
        XMLWatchdog(FileWatchdog).run() line: 104
    Daemon Thread [Timer-0] (Suspended)
        Object.wait(long) line: not available [native method]
        TaskQueue(Object).wait() line: 474
        TimerThread.mainLoop() line: 483
        TimerThread.run() line: 462
    Daemon Thread [MySQL Statement Cancellation Timer] (Suspended)
        Object.wait(long) line: not available [native method]
        TaskQueue(Object).wait() line: 474
        TimerThread.mainLoop() line: 483
        TimerThread.run() line: 462
    Daemon Thread [Thread-4] (Suspended)
        Thread.sleep(long) line: not available [native method]
        SockIOPool$MaintThread.run() line: 1316
    Daemon Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]]
(Suspended)
        Thread.sleep(long) line: not available [native method]
        ContainerBase$ContainerBackgroundProcessor.run() line: 1548
        Thread.run() line: 613
    Daemon Thread [http-8080-Processor1] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor2] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor3] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor4] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor5] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor6] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor7] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor9] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor8] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor10] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor11] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor12] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor13] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor14] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor15] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor16] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor17] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor18] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor19] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor20] (Suspended)
        LinkedHashMap$EntryIterator.next() line: 383
        IdentityMap.entryList() line: 194
        IdentityMap.entries(Map) line: 71

DefaultFlushEventListener(AbstractFlushingEventListener).flushCollections(EventSource)
line: 226

DefaultFlushEventListener(AbstractFlushingEventListener).flushEverythingToExecutions(FlushEvent)
line: 77
        DefaultFlushEventListener.onFlush(FlushEvent) line: 26
        SessionImpl.flush() line: 1004
        SessionImpl.managedFlush() line: 342
        JDBCTransaction.commit() line: 136
        HibernateTransactionManager.doCommit(DefaultTransactionStatus) line:
655

HibernateTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus)
line: 709

HibernateTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus)
line: 678

TransactionInterceptor(TransactionAspectSupport).commitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo)
line: 321
        TransactionInterceptor.invoke(MethodInvocation) line: 116

Cglib2AopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed()
line: 171
        Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Object, Method,
Object[], MethodProxy) line: 635
        InterestGroupManager$$EnhancerByCGLIB$$157e5129.fetchInterest(Long)
line: not available
        InterestService.fetchInterest(Long, List<String>) line: 531
        InterestService.fetchSuggestedInterests(Long, int, Locale,
List<String>) line: 583
        UserController.addtopics(HttpServletRequest, HttpServletResponse)
line: 197
        NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
        NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
        DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
        Method.invoke(Object, Object...) line: 585
        UserController(MultiActionController).invokeNamedMethod(String,
HttpServletRequest, HttpServletResponse) line: 473

UserController(MultiActionController).handleRequestInternal(HttpServletRequest,
HttpServletResponse) line: 410

UserController(RestfulApiController).handleRequestInternal(HttpServletRequest,
HttpServletResponse) line: 175
        UserController(AbstractController).handleRequest(HttpServletRequest,
HttpServletResponse) line: 153
        SimpleControllerHandlerAdapter.handle(HttpServletRequest,
HttpServletResponse, Object) line: 48
        DispatcherServlet.doDispatch(HttpServletRequest,
HttpServletResponse) line: 875
        DispatcherServlet.doService(HttpServletRequest, HttpServletResponse)
line: 809

DispatcherServlet(FrameworkServlet).processRequest(HttpServletRequest,
HttpServletResponse) line: 571
        DispatcherServlet(FrameworkServlet).doGet(HttpServletRequest,
HttpServletResponse) line: 501
        DispatcherServlet(HttpServlet).service(HttpServletRequest,
HttpServletResponse) line: 690
        DispatcherServlet(HttpServlet).service(ServletRequest,
ServletResponse) line: 803
        ApplicationFilterChain.internalDoFilter(ServletRequest,
ServletResponse) line: 269
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
line: 188
        ParameterizedPathFilter.doFilter(ServletRequest, ServletResponse,
FilterChain) line: 57
        ApplicationFilterChain.internalDoFilter(ServletRequest,
ServletResponse) line: 215
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
line: 188
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 359
        FilterSecurityInterceptor.invoke(FilterInvocation) line: 109
        FilterSecurityInterceptor.doFilter(ServletRequest, ServletResponse,
FilterChain) line: 83
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 371
        SessionFixationProtectionFilter.doFilterHttp(HttpServletRequest,
HttpServletResponse, FilterChain) line: 52

SessionFixationProtectionFilter(SpringSecurityFilter).doFilter(ServletRequest,
ServletResponse, FilterChain) line: 53
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 371
        ExceptionTranslationFilter.doFilterHttp(HttpServletRequest,
HttpServletResponse, FilterChain) line: 101

ExceptionTranslationFilter(SpringSecurityFilter).doFilter(ServletRequest,
ServletResponse, FilterChain) line: 53
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 371
        AnonymousProcessingFilter.doFilterHttp(HttpServletRequest,
HttpServletResponse, FilterChain) line: 105

AnonymousProcessingFilter(SpringSecurityFilter).doFilter(ServletRequest,
ServletResponse, FilterChain) line: 53
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 371

SecurityContextHolderAwareRequestFilter.doFilterHttp(HttpServletRequest,
HttpServletResponse, FilterChain) line: 91

SecurityContextHolderAwareRequestFilter(SpringSecurityFilter).doFilter(ServletRequest,
ServletResponse, FilterChain) line: 53
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 371

AuthenticationProcessingFilter(BasicProcessingFilter).doFilterHttp(HttpServletRequest,
HttpServletResponse, FilterChain) line: 173
        AuthenticationProcessingFilter.doFilterHttp(HttpServletRequest,
HttpServletResponse, FilterChain) line: 61

AuthenticationProcessingFilter(SpringSecurityFilter).doFilter(ServletRequest,
ServletResponse, FilterChain) line: 53
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 371
        HttpSessionContextIntegrationFilter.doFilterHttp(HttpServletRequest,
HttpServletResponse, FilterChain) line: 235

HttpSessionContextIntegrationFilter(SpringSecurityFilter).doFilter(ServletRequest,
ServletResponse, FilterChain) line: 53
        FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest,
ServletResponse) line: 371
        FilterChainProxy.doFilter(ServletRequest, ServletResponse,
FilterChain) line: 174
        DelegatingFilterProxy.invokeDelegate(Filter, ServletRequest,
ServletResponse, FilterChain) line: 236
        DelegatingFilterProxy.doFilter(ServletRequest, ServletResponse,
FilterChain) line: 167
        ApplicationFilterChain.internalDoFilter(ServletRequest,
ServletResponse) line: 215
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
line: 188
        CharEncodingFilter.doFilter(ServletRequest, ServletResponse,
FilterChain) line: 17
        DelegatingFilterProxy.invokeDelegate(Filter, ServletRequest,
ServletResponse, FilterChain) line: 236
        DelegatingFilterProxy.doFilter(ServletRequest, ServletResponse,
FilterChain) line: 167
        ApplicationFilterChain.internalDoFilter(ServletRequest,
ServletResponse) line: 215
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
line: 188
        DisableUrlSessionFilter.doFilter(ServletRequest, ServletResponse,
FilterChain) line: 44
        ApplicationFilterChain.internalDoFilter(ServletRequest,
ServletResponse) line: 215
        ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
line: 188
        StandardWrapperValve.invoke(Request, Response) line: 213
        StandardContextValve.invoke(Request, Response) line: 174
        StandardHostValve.invoke(Request, Response) line: 127
        ErrorReportValve.invoke(Request, Response) line: 117
        StandardEngineValve.invoke(Request, Response) line: 108
        CoyoteAdapter.service(Request, Response) line: 174
        Http11Processor.process(InputStream, OutputStream) line: 874

Http11Protocol$JmxHttp11ConnectionHandler(Http11BaseProtocol$Http11ConnectionHandler).processConnection(TcpConnection,
Object[]) line: 665
        PoolTcpEndpoint.processSocket(Socket, TcpConnection, Object[]) line:
528
        LeaderFollowerWorkerThread.runIt(Object[]) line: 81
        ThreadPool$ControlRunnable.run() line: 689
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor21] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor22] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor23] (Suspended)
        PlainSocketImpl.socketAccept(SocketImpl) line: not available [native
method]
        SocksSocketImpl(PlainSocketImpl).accept(SocketImpl) line: 384
        ServerSocket.implAccept(Socket) line: 450
        ServerSocket.accept() line: 421
        DefaultServerSocketFactory.acceptSocket(ServerSocket) line: 61
        PoolTcpEndpoint.acceptSocket() line: 408
        LeaderFollowerWorkerThread.runIt(Object[]) line: 71
        ThreadPool$ControlRunnable.run() line: 689
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor24] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [http-8080-Processor25] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Thread [http-8080-Monitor] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$MonitorRunnable.run() line: 564
        Thread.run() line: 613
    Daemon Thread [TP-Processor1] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [TP-Processor2] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [TP-Processor3] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$ControlRunnable(Object).wait() line: 474
        ThreadPool$ControlRunnable.run() line: 661
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [TP-Processor4] (Suspended)
        PlainSocketImpl.socketAccept(SocketImpl) line: not available [native
method]
        SocksSocketImpl(PlainSocketImpl).accept(SocketImpl) line: 384
        ServerSocket.implAccept(Socket) line: 450
        ServerSocket.accept() line: 421
        ChannelSocket.accept(MsgContext) line: 312
        ChannelSocket.acceptConnections() line: 666
        ChannelSocket$SocketAcceptor.runIt(Object[]) line: 876
        ThreadPool$ControlRunnable.run() line: 689
        ThreadWithAttributes(Thread).run() line: 613
    Daemon Thread [TP-Monitor] (Suspended)
        Object.wait(long) line: not available [native method]
        ThreadPool$MonitorRunnable.run() line: 564
        Thread.run() line: 613


At first I thought it was a problem with starting Tomcat through Eclipse
using Sysdeo's plugin, but if I check the box for "Don't run Tomcat in debug
mode," everything runs fine again. When configuring Tomcat to support remote
debugging and running from the command line, as described here:
http://wiki.apache.org/tomcat/FAQ/Developing, it runs fine but chokes again
when I attach the Eclipse debugger to the VM that Tomcat is running under.
Logs appear to reveal nothing out of the ordinary.

Other info:
JDK 1.5.0 on a Mac
Eclipse 3.4.0
Tomcat 5.5.26

Any help or at least a point in the right direction for diagnosing this
problem would be greatly appreciated.

Kelly

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message