API
-
- Posts: 24
- Joined: Fri Apr 13, 2012 1:20 pm
Re: API
I Tested in another machine, I attached the application ok like log below, but occurs the same error in Controller class. Process with PID=1164 does not exist or is not started with YourKit Profiler
7.0.0 - 0.000: Command line:
C:\CorporeRM\RMRestore\RM.Restore.exe
7.0.0 - 0.001: Executable: C:\CorporeRM\RMRestore\RM.Restore.exe
7.0.0 - 0.001: Windows 7; version 6.1; 32-bit process
7.0.0 - 0.000: Reading startup options
7.0.0 - 0.001: Environment variable YNP_STARTUP_OPTIONS: not defined
7.0.0 - 0.001: Registry key HKLM\SOFTWARE\YNP\STARTUP_OPTIONS:
7.0.0 - 0.001: CLR_Agent_OnAttach: options=
7.0.0 - 0.004: shmem: Global\YOURKIT SHARE5 G: OK, isFirst=0
7.0.0 - 0.004: shmem: Local\YOURKIT SHARE5 L: OK, isFirst=0
7.0.0 - 0.006: shmem: Global\YOURKIT SHARE2 G: OK, isFirst=1
7.0.0 - 0.006: shmem: Local\YOURKIT SHARE2 L: OK, isFirst=1
7.0.0 - 0.009: shmem: Global\YOURKIT DOTNET1 G: OK, isFirst=1
7.0.0 - 0.010: shmem: Local\YOURKIT DOTNET1 L: OK, isFirst=1
7.0.0 - 0.011: agent is listening on port 10001
7.0.0 - 0.011: setTriggers:
7.0.0 - 0.011: setTriggers: OK
7.0.0 - 548.604: CPU profiling is started
7.0.0 - 0.000: Command line:
C:\CorporeRM\RMRestore\RM.Restore.exe
7.0.0 - 0.001: Executable: C:\CorporeRM\RMRestore\RM.Restore.exe
7.0.0 - 0.001: Windows 7; version 6.1; 32-bit process
7.0.0 - 0.000: Reading startup options
7.0.0 - 0.001: Environment variable YNP_STARTUP_OPTIONS: not defined
7.0.0 - 0.001: Registry key HKLM\SOFTWARE\YNP\STARTUP_OPTIONS:
7.0.0 - 0.001: CLR_Agent_OnAttach: options=
7.0.0 - 0.004: shmem: Global\YOURKIT SHARE5 G: OK, isFirst=0
7.0.0 - 0.004: shmem: Local\YOURKIT SHARE5 L: OK, isFirst=0
7.0.0 - 0.006: shmem: Global\YOURKIT SHARE2 G: OK, isFirst=1
7.0.0 - 0.006: shmem: Local\YOURKIT SHARE2 L: OK, isFirst=1
7.0.0 - 0.009: shmem: Global\YOURKIT DOTNET1 G: OK, isFirst=1
7.0.0 - 0.010: shmem: Local\YOURKIT DOTNET1 L: OK, isFirst=1
7.0.0 - 0.011: agent is listening on port 10001
7.0.0 - 0.011: setTriggers:
7.0.0 - 0.011: setTriggers: OK
7.0.0 - 548.604: CPU profiling is started
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: API
We cannot reproduce the problem.
Anyway, please try this build (it will identify itself as 7.0.1):
http://www.yourkit.com/download/tmp/201 ... r-.NET.exe
It should provide better diagnostics if an exception happens when calling "new Controller(pid);"
Anyway, please try this build (it will identify itself as 7.0.1):
http://www.yourkit.com/download/tmp/201 ... r-.NET.exe
It should provide better diagnostics if an exception happens when calling "new Controller(pid);"
-
- Posts: 24
- Joined: Fri Apr 13, 2012 1:20 pm
Re: API
Occurs this error:
Unable to load DLL 'ynpagent.dll': It was not possible to find the specified module. (Exception from HRESULT: 0x8007007E)
I registered this assembly and try again and occurs the same error.
I also tried to add this assembly in my project, but Visual Studio does not allow, it generate the following message:
A reference to 'C:\Program Files\YourKit Profiler 7.0.1 for .NET\bin\win32\ynpagent.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
Unable to load DLL 'ynpagent.dll': It was not possible to find the specified module. (Exception from HRESULT: 0x8007007E)
I registered this assembly and try again and occurs the same error.
I also tried to add this assembly in my project, but Visual Studio does not allow, it generate the following message:
A reference to 'C:\Program Files\YourKit Profiler 7.0.1 for .NET\bin\win32\ynpagent.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: API
The dll should not be registered for the API purposes. Instead, it should be in the PATH.
Also, there are 2 versions of ynpagent.dll: 32-bit in <profiler dir>\bin\win32 and 64-bit in <profiler dir>\bin\win64
You should put to PATH the one which corresponds to the process which uses the controller.
Also, there are 2 versions of ynpagent.dll: 32-bit in <profiler dir>\bin\win32 and 64-bit in <profiler dir>\bin\win64
You should put to PATH the one which corresponds to the process which uses the controller.
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: API
We cannot reproduce the problem, but is cleared related with CLR's inability to load ynpagent.dll for some reason.
Can you send to [email protected] an isolated example (a VS project) with the class which uses the controller, which reproduces the problem?
Anyway, we are considering alternative approaches to avoid API dependencies on ynpagent.dll or to automatically ensure it is properly loaded.
How do you use YourKit.Profiler.Api.dll: do you copy the file somewhere inside your project, or refer the copy existing in <profiler installation directory>\api ?
Do you run the process which uses the controller and the profiled application under the same user?
Can you send to [email protected] an isolated example (a VS project) with the class which uses the controller, which reproduces the problem?
Anyway, we are considering alternative approaches to avoid API dependencies on ynpagent.dll or to automatically ensure it is properly loaded.
How do you use YourKit.Profiler.Api.dll: do you copy the file somewhere inside your project, or refer the copy existing in <profiler installation directory>\api ?
Do you run the process which uses the controller and the profiled application under the same user?
-
- Posts: 24
- Joined: Fri Apr 13, 2012 1:20 pm
Re: API
Yes, the user is the sameAnton Katilin wrote:We cannot reproduce the problem, but is cleared related with CLR's inability to load ynpagent.dll for some reason.
Can you send to [email protected] an isolated example (a VS project) with the class which uses the controller, which reproduces the problem?
Anyway, we are considering alternative approaches to avoid API dependencies on ynpagent.dll or to automatically ensure it is properly loaded.
How do you use YourKit.Profiler.Api.dll: do you copy the file somewhere inside your project, or refer the copy existing in <profiler installation directory>\api ?
I refer the copy existing in <profiler installation directory>\api
Do you run the process which uses the controller and the profiled application under the same user?
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: API
Thank you for the detail.
Please try the new build:
http://www.yourkit.com/download/tmp/201 ... r-.NET.exe
YourKit.Profiler.Api.dll does not depend on ynpagent.dll anymore.
Please try the new build:
http://www.yourkit.com/download/tmp/201 ... r-.NET.exe
YourKit.Profiler.Api.dll does not depend on ynpagent.dll anymore.
-
- Posts: 24
- Joined: Fri Apr 13, 2012 1:20 pm
Re: API
Occurs another error:
Process 2540 has not been started with the profiler, or has a different user home: file C:\Users\jarbas.carvalho\.ynp\log\2540.log does not exist
I saw in this directory and really this log does not exists, but I had already started the application with profiler.
Mine instace of Controller class is that:
Controller controller = new Controller(2540);
Thank You.
Process 2540 has not been started with the profiler, or has a different user home: file C:\Users\jarbas.carvalho\.ynp\log\2540.log does not exist
I saw in this directory and really this log does not exists, but I had already started the application with profiler.
Mine instace of Controller class is that:
Controller controller = new Controller(2540);
Thank You.
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: API
An important update:
I re-read again the entire thread and found the following:
Then of course the log file is not found because it is located in another directory.
So, there are 3 solutions
1) if you want to use "new Controller(pid)":
Explicitly specify the home directory for both the profiler agent and the program which uses controller. Specify environment variable YOURKIT_HOME and set it to an arbitrary directory e.g. c:\yourkit.
Ensure that all users on the machine have read and write access to it (to ensure the service can access it).
YOURKIT_HOME must be a system variable (there is corresponding option in Windows UI where environment variables are used).
2) almost same as #1, also to use new Controller(pid):
specify a different directory for the logs using startup option "logdir":
http://www.yourkit.com/docs/net70/help/ ... jsp#logdir
It should be your "normal" user home. Perhaps you will need to grant permissions to the service user.
This does not require setting environment variables.
3) you can hard code the port for the agent using startup option "port":
http://www.yourkit.com/docs/net70/help/ ... s.jsp#port
and then use new Controller("localhost", port);
I re-read again the entire thread and found the following:
This means that the server runs under _different_ user (special user for servers).Notice that I have been to profiled this application before.
Mine application is Windows Service type.
Then of course the log file is not found because it is located in another directory.
So, there are 3 solutions
1) if you want to use "new Controller(pid)":
Explicitly specify the home directory for both the profiler agent and the program which uses controller. Specify environment variable YOURKIT_HOME and set it to an arbitrary directory e.g. c:\yourkit.
Ensure that all users on the machine have read and write access to it (to ensure the service can access it).
YOURKIT_HOME must be a system variable (there is corresponding option in Windows UI where environment variables are used).
2) almost same as #1, also to use new Controller(pid):
specify a different directory for the logs using startup option "logdir":
http://www.yourkit.com/docs/net70/help/ ... jsp#logdir
It should be your "normal" user home. Perhaps you will need to grant permissions to the service user.
This does not require setting environment variables.
3) you can hard code the port for the agent using startup option "port":
http://www.yourkit.com/docs/net70/help/ ... s.jsp#port
and then use new Controller("localhost", port);
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: API
We will also add constructor Controller(int pid, String userHome).
Learn the server's user home (on Vista and Windows 7 it is also C:\Users\<some name>), and specify it alongside the PID. This should allow to avoid actions 1-3 from my previous posting.
Learn the server's user home (on Vista and Windows 7 it is also C:\Users\<some name>), and specify it alongside the PID. This should allow to avoid actions 1-3 from my previous posting.
-
- Posts: 24
- Joined: Fri Apr 13, 2012 1:20 pm
Re: API
Hello Anton,
I made many tests and saw that mine windows service application is running like "Network Service" user. Then I tried to attach another different application and it works correctly.
Then I changed the environmnent variable YOURKIT_HOME like you had said and even thus it does not work.
Then I researched in all of directories and I dont found anything with my PID.log e.g. 4524.log.
I think when the service running with network service user, the yourkit does not store the log file in disk.
Thank you so much.
I made many tests and saw that mine windows service application is running like "Network Service" user. Then I tried to attach another different application and it works correctly.
Then I changed the environmnent variable YOURKIT_HOME like you had said and even thus it does not work.
Then I researched in all of directories and I dont found anything with my PID.log e.g. 4524.log.
I think when the service running with network service user, the yourkit does not store the log file in disk.
Thank you so much.
-
- Posts: 6172
- Joined: Wed Aug 11, 2004 8:37 am
Re: API
By default it creates log file inside Network Service user home.
If you search for a file not being an administrator user, you won't find it, because of lack of permissions to enter the directory.
But it is created.
We'll make new build soon. We are working on it now. And our tests should that the approach with Controller(pid, homeDir) perfectly works for a service (we try with IIS). And as I wrote it works without the need to tweak YOURKIT_HOME
In meanwhile lets find where Network Service user home is located on your machine. What is the version of Windows?
If you search for a file not being an administrator user, you won't find it, because of lack of permissions to enter the directory.
But it is created.
We'll make new build soon. We are working on it now. And our tests should that the approach with Controller(pid, homeDir) perfectly works for a service (we try with IIS). And as I wrote it works without the need to tweak YOURKIT_HOME
In meanwhile lets find where Network Service user home is located on your machine. What is the version of Windows?