Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Execution hangs at controller constructor

Moderators: Vladimir Kondratyev, Anton Katilin

Execution hangs at controller constructor

Postby sandeep » Sun Oct 28, 2012 9:07 am

I use Controller() to see if a particular process has YourKit agent attached to it. Sometimes the function never returns for certain process ids. That last time it happened, I checked which process it freezes at, and it was calc.exe.

I tried to reproduce the problem by closing and starting another instances of windows calculator application, but I was unable to get it to freeze.

Previously, I have had the same problem when using overloaded controller constructor that uses hostname and agent port. - Controller(String, Int32)
sandeep
 
Posts: 24
Joined: Wed May 16, 2012 3:08 pm

Re: Execution hangs at controller constructor

Postby Anton Katilin » Sun Oct 28, 2012 1:46 pm

How did you get the PID list?

Do you mean you enumerated all processed on the machine and applied the Controller(int pid) constructor to each PID?
Anton Katilin
 
Posts: 5565
Joined: Wed Aug 11, 2004 8:37 am

Re: Execution hangs at controller constructor

Postby sandeep » Sun Oct 28, 2012 7:14 pm

Yes. Is there any other way?
sandeep
 
Posts: 24
Joined: Wed May 16, 2012 3:08 pm

Re: Execution hangs at controller constructor

Postby Anton Katilin » Sun Oct 28, 2012 7:57 pm

Check only those processes for which the profiler agent log file exists.

The following pseudo-code illustrates how to do it:
Code: Select all
int[] allPIDs = ...; // get all PIDs as you do it now
foreach (int pid in allPIDs)
{
   if (File.Exists("<user home directory>/.ynp/log/" + pid + ".log)) {
      // ... perform the check with new Controller() as you do it now...
   }
}

Please don't forget to replace <user home directory> with the home directory under which the applications to be detected has been started.
Anton Katilin
 
Posts: 5565
Joined: Wed Aug 11, 2004 8:37 am

Re: Execution hangs at controller constructor

Postby Anton Katilin » Sun Oct 28, 2012 8:01 pm

Also, you can periodically cleanup the log file directory <user home directory>/.ynp/log to reduce probability to hit an old log file created for a finished application whose PID by chance matches the PID of one of the currently running processes which are not started with the profiler.
Anton Katilin
 
Posts: 5565
Joined: Wed Aug 11, 2004 8:37 am

Re: Execution hangs at controller constructor

Postby Anton Katilin » Sun Oct 28, 2012 8:04 pm

By the way, could you please explain your intention. Why do you need to list all processes with the agent loaded?
Anton Katilin
 
Posts: 5565
Joined: Wed Aug 11, 2004 8:37 am

Re: Execution hangs at controller constructor

Postby sandeep » Sun Oct 28, 2012 9:51 pm

Anton Katilin wrote:By the way, could you please explain your intention. Why do you need to list all processes with the agent loaded?


We using it to auto-collect all snapshots at real-time and store them in a centralized data store, so people can go back to any time and see how the application was performing
sandeep
 
Posts: 24
Joined: Wed May 16, 2012 3:08 pm

Re: Execution hangs at controller constructor

Postby sandeep » Sun Oct 28, 2012 9:53 pm

Anton Katilin wrote:Check only those processes for which the profiler agent log file exists.

The following pseudo-code illustrates how to do it:
Code: Select all
int[] allPIDs = ...; // get all PIDs as you do it now
foreach (int pid in allPIDs)
{
   if (File.Exists("<user home directory>/.ynp/log/" + pid + ".log)) {
      // ... perform the check with new Controller() as you do it now...
   }
}

Please don't forget to replace <user home directory> with the home directory under which the applications to be detected has been started.


Thanks. I think this method is a bit more efficient also.
sandeep
 
Posts: 24
Joined: Wed May 16, 2012 3:08 pm


Return to .NET Profiler

Who is online

Users browsing this forum: Google [Bot] and 3 guests