Unable to Attach

Questions about YourKit .NET Profiler
Post Reply
scottagillette
Posts: 6
Joined: Wed Nov 12, 2014 2:52 pm

Unable to Attach

Post by scottagillette »

I am running a .NET Web application with the following:

- Application pool classic mode
- Running against the 3.5 Framework
- Using Web Forms
- Project Type "Web Site"
- Windows 2008 R2
- IIS 7.5

I'm trying to locally profile the application but it's unable to attach to the application. I've done the following:

- Running the application as administrator
- Verified the ports in range 10000-10010 are open
- Verified windows firewall is off (not sure if this matters for local execution)
- Set system variables for the two "COR" values to enable profiling

I've been able to profile this application locally when deployed to IIS; but am having problems with getting local profiling setup for the test server. Any help would be appricated which would then lead us to purchasing licenses.

Thanks

(p.s. we already have and use the Java profiler with a lot of success, this is the first time we have had a new for the .NET version)
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to Attach

Post by Anton Katilin »

Hi Scott,

Did you install the full profiler UI on that test machine or only the command line tools for remote profiling? (Both variants should allow profiling, I'm asking just to clarify the situation.)
http://www.yourkit.com/dotnet/download/

If the full UI: did you use the "Profiler IIS" action?
http://www.yourkit.com/docs/dotnet/help ... al_iis.jsp

Otherwise, did you use YourKitTools.exe as described here?
http://www.yourkit.com/docs/dotnet/help ... remote.jsp

If the full UI:
- if you see the IIS process in the list of locally running applications, what is its status?
- could you please run "Help | Collect Information for Support..." on that machine and send us by email to [email protected]

Best regards,
Anton
scottagillette
Posts: 6
Joined: Wed Nov 12, 2014 2:52 pm

Re: Unable to Attach

Post by scottagillette »

Thanks for the quick response.

I installed the full profiler (build 14520) on the test server directly for local profiling of an IIS application.

I did use the "IIS Application" link on the "Profile" section of the startup page in YourKit.

The w3wp.exe process stopped and when I used the application came back into the list but with the "Started without profiler" as the Profiler Status.

Unfortunately the "Collecting System Information" doesn't complete, and the YourKitTools.exe continues to run but not complete.

Also in the event viewer I noticed quite a few error events.

".NET Runtime version 4.0.30319.34209 - Loading profiler failed. The profiler COM object was instantiated, but the profiler failed during its initialization callback. Profiler CLSID: '{CA14F97A-5671-44FA-94FA-4515252F56AA}'. HRESULT: 0x80004005. Process ID (decimal): 692. Message ID: [0x2505]."
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to Attach

Post by Anton Katilin »

Could you please manually run the following commands in console running it as administrator:

Code: Select all

cd <profiler installation directory>\bin
YourKitTools32.exe system-info -utf-8 -skip-users -out-file path_to_some_writable_directory\ynp32.txt
YourKitTools64.exe system-info -utf-8 -skip-users -out-file path_to_some_writable_directory\ynp64.txt
They should create text files with profiler logs and other profiling-related settings which may help us investigating this issue.
scottagillette
Posts: 6
Joined: Wed Nov 12, 2014 2:52 pm

Re: Unable to Attach

Post by scottagillette »

Email sent.

I didn't have a YourKitTools32.exe installed so I ran both YourKitTools.exe and YourKitTools64.exe. Both completed successfully.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to Attach

Post by Anton Katilin »

Thank you. We've got your email. We're reading the logs.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to Attach

Post by Anton Katilin »

Hi,

Due to the architecture of .NET, you can run only one profiler at a time.

Please try the following steps (the order matters):

1. Uninstall all installed YourKit .NET profiler versions except for the latest build 14520 (if any).

2. Uninstall other tools using .NET profiling agents. (According to the logs you might have NewRelic Server Monitor installed.)

3. Remove from user and system environment the variables
COR_ENABLE_PROFILING
COR_PROFILER

4. Reboot the machine (to apply environment change).

5. Run the profiler as administrator.

6. Use a fixed logs directory: in the "Profile | IIS application" dialog
use the link "Advanced startup options" to add the following line

logdir=C:\Windows\TEMP\ynplogs

You may use a different directory, but please note it should be writable for IIS (w3wp.exe).

7. Press "Profile", access your application...

8. If the status is still "Started without profiler", could you please send the logs from the above specified directory (if created).

Best regards,
Anton
scottagillette
Posts: 6
Joined: Wed Nov 12, 2014 2:52 pm

Re: Unable to Attach

Post by scottagillette »

I uninstalled New Relic; verified the COR_* environment variables are removed and restarted the system. The IIS processes (W3WP.exe) created are still listed as not started with profiler. Email with logs sent.
scottagillette
Posts: 6
Joined: Wed Nov 12, 2014 2:52 pm

Re: Unable to Attach

Post by scottagillette »

I still see a number of failures in the event viewer when trying to profile the application.

.NET Runtime version 4.0.30319.34209 - Loading profiler failed. The profiler COM object was instantiated, but the profiler failed during its initialization callback. Profiler CLSID: '{CA14F97A-5671-44FA-94FA-4515252F56AA}'. HRESULT: 0x80004005. Process ID (decimal): 3736. Message ID: [0x2505].
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to Attach

Post by Anton Katilin »

Hi Scott,

We've got the logs, thank you. We'll answer by email ASAP.

Best regards,
Anton
scottagillette
Posts: 6
Joined: Wed Nov 12, 2014 2:52 pm

Re: Unable to Attach

Post by scottagillette »

Cleaning the registry of the New Relic COR_* values for W3SRV and WAS fixed the problem.

Thanks for your help.

-S
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Unable to Attach

Post by Anton Katilin »

Great news! Thank you for the feedback.

Unfortunately, the CLR way to enable profiling is cumbersome, it allows to do the same things using different approaches which may interfere, and issues are often difficult to investigate.
Post Reply