Tweaking Profiler Timeouts
By Jiri Sedlacek on Jan 24, 2007
In general the Profiler consists of two independent parts: Profiler tool and Profiler agent. During profiling these two parts communicate together and are able to notify each other about important lifecycle events - Profiler tool sends a "Profiling stopped" command to the agent which stops profiled application or the agent informs the tool about profiled application shutdown.
In case the communication between tool and started agent fails for some reason, the agent might block the profiled application and prevent it to startup completely or shutdown correctly. For this reason a connection timeout mechanism is implemented which automatically finishes the agent and profiled application if the connection to the tool isn't established in time. For Direct Attach you may control the timeout manually as described in Understanding Profiler Agent Parameters post. For Profile Project action where the agent is started automatically the timeout is 10 seconds by default.
Another failure may happen during agent startup or if the agent isn't started at all. This is typical for profiling J2EE applications due to profiled server startup failure. When a J2EE application is being profiled using Profile Project action, the Profiler tool asks appropriate server plugin to start target server in profiling mode and then tries to connect to the agent. If a problem occurs and the agent doesn't (fully) start, the tool timeouts waiting for the agent after 20 seconds by default.
Default values for both timeouts are set to allow smooth profiling startup when everything works correctly and on the other side to timeout trying to start profiling session if anything fails. But sometimes you may need to profile some application on some machine where the default timeout is not enough - either the application does some extra processing before starting the Profiler agent and/or the system is simply slow. In that case there's a possibility to tweak default timeout values by setting the following properties:
profiler.agent.connect.timeout- [seconds], default=10, since Profiler 6.0 Milestone 6 - timeout after which the already started agent not able to connect to Profiler tool stops itself and the profiled application.
profiler.agent.startup.timeout- [milliseconds], default=20000, since Profiler 5.0 - timeout after which the Profiler tool not able to connect to the agent gives up profiling J2EE application using Profile Project action.
To set (one of) these properties, start the NetBeans IDE with appropriate option:
netbeans -J-D<property.name>. For example setting the agent connection timeout to 20 seconds can be done by starting the IDE using