Why does VisualVm does not show all threads in a running tomcat?

My tomcat (version: 5.5.25) runs an application which I try to profile with VisualVM (ver: 1.3.2). Everything looks nice but not all classes and methods are shown in visualVM. They ones that are missing run in thread [main]. I know this because this is the thread's name I receive if I a breakpoint has been hit. Classes which run outside main e.g. [worker1] , [worker2], ... are shown correctly.

Any idea what the reasons might be? Or what I could try?

Since the application I run (it is called Assentis Docbase) is closed-source they might have customized the default tomcat configuration. But they allowed me to extend the framework with my own classes and that are the ones I want to profile.

VisualVM I run with the default configuration as downloaded.

Upvotes: 6

Views: 8129

Answers (4)

try-catch-finally
try-catch-finally

Reputation: 7624

You've probably badly configured "Start profiling from classes" in the plugin config.

Say you've configured org.acme.competition.* (A) for profiling:

VisualVM Startup config dialog

but you've accidentally profiled the class org.acme.reference.ReferenceImpl (B) using a command lie this:

$ cat source.txt | java -Xverify:none \
    -agentpath:/usr/share/visualvm/profiler/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so=/usr/share/visualvm/profiler/lib,5140 \
    -cp bin/ org.acme.reference.ReferenceImpl

then this would be the wrong result:

Wrong result

When configuring VisualVM's Startup plugin config "Start profiling from classes" with org.acme.reference.* instead, the result is correct:

Correct result

See the Startup profiler guide too.

Upvotes: 1

The reason why VisualVM did not show my method calls in thread [main] is that VisualVM allows only to profile up to 32 threads simoultanously. It is NOT possible to allow more threads to be watched. This has been documented in Profiling With VisualVM, Part 2, section "Comparison With The NetBeans Profiler" they say:

"Profiled threads limit is always 32."

:-(

Upvotes: 2

Tomas Hurka
Tomas Hurka

Reputation: 6981

You probably need to customize profiling root methods. See Profiling With VisualVM, Part 1 and Profiling With VisualVM, Part 2. You can also use 'Sampler' tab to get high-level picture of what is your Tomcat doing.

Upvotes: 8

Stephen C
Stephen C

Reputation: 718788

Here are a couple of reasons why you may not be able to see the "main" thread:

  • The thread could have exited.

  • The thread could have changed its name by calling Thread.setName().

If you want to figure out the real reason, you will probably need to look at the Tomcat source code.


This page tells you where the settings are. Google is your friend.

Upvotes: 2

Related Questions