Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 231078 - [Attach profiler] Cannot attach profiler to JDK6/JDK7 instance when running NetBeans with JDK7
[Attach profiler] Cannot attach profiler to JDK6/JDK7 instance when running N...
Status: RESOLVED WORKSFORME
Product: profiler
Classification: Unclassified
Component: Attach
7.4
PC Windows XP
: P2 (vote)
: TBD
Assigned To: issues@profiler
issues@profiler
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-11 11:45 UTC by markiewb
Modified: 2013-06-17 16:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-06-11 11:45:24 UTC
* Profile|Attach Profiler...
* CPU - Sampling mode
* Attach Mode: Local dynamic attach to Java application
* try to connect to a JDK6/JDK7 JVM instance
-> ACTUAL: IOException: Zugriff verweigert (== Access denied)

Content of the log:
INFO [org.netbeans.lib.profiler.infolog]: >>> Profiling settings: New CPU Analysis
>>> Attach settings: target type =Java application
server type =Java application
remote =false
direct =false
dynamic JDK16 =true
pid =-1
host =
host os =Windows, 32bit JVM
transient port =-1
java.io.IOException: Zugriff verweigert
	at sun.tools.attach.WindowsVirtualMachine.openProcess(Native Method)
	at sun.tools.attach.WindowsVirtualMachine.<init>(WindowsVirtualMachine.java:56)
	at sun.tools.attach.WindowsAttachProvider.attachVirtualMachine(WindowsAttachProvider.java:69)
	at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
	at org.netbeans.modules.profiler.NetBeansProfiler.loadAgentIntoTargetJVM(NetBeansProfiler.java:810)
	at org.netbeans.modules.profiler.NetBeansProfiler.attachToApp(NetBeansProfiler.java:782)
	at org.netbeans.modules.profiler.nbimpl.NetBeansProfiler.attachToApp(NetBeansProfiler.java:112)
	at org.netbeans.modules.profiler.actions.ProfilingSupport$1.run(ProfilingSupport.java:309)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)


The same issue alsoe occures when running NB 7.3.1 with JDK7. So here the combination matrix.
 
The profiler of NB 7.3.1  with JDK6 CAN attach to a JDK6 JVM instance.
The profiler of NB 7.3.1  with JDK6 CAN attach to a JDK7 JVM instance.
The profiler of NB 7.3.1  with JDK7 CANNOT attach to a JDK6 JVM instance.
The profiler of NB 7.4Dev with JDK7 CANNOT attach to a JDK6 JVM instance.
The profiler of NB 7.4Dev with JDK7 CANNOT attach to a JDK7 JVM instance.

FYI: Combination of NB 7.4Dev with JDK6 is not possible because NB74 requires JDK7.

The strange thing is that 
* when I use JVisualVM (from the JDK7 installation) the attachment to the JDK6 JVM instance works [sic!].
* when I use JVisualVM (from the JDK7 installation) the attachment to the JDK7 JVM instance DOES NOT work. - there will also be an exception

INFO [com.sun.tools.visualvm.attach.AttachModelImpl]: getSystemProperties
java.io.IOException: Zugriff verweigert
	at sun.tools.attach.WindowsVirtualMachine.openProcess(Native Method)
	at sun.tools.attach.WindowsVirtualMachine.<init>(WindowsVirtualMachine.java:56)
	at sun.tools.attach.WindowsAttachProvider.attachVirtualMachine(WindowsAttachProvider.java:69)
	at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
	at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:104)
Caused: java.io.IOException: Zugriff verweigert
	at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:106)
[catch] at com.sun.tools.visualvm.attach.AttachModelImpl.getSystemProperties(AttachModelImpl.java:36)
	at com.sun.tools.visualvm.jvm.JVMImpl.getSystemProperties(JVMImpl.java:274)
	at com.sun.tools.visualvm.application.type.NetBeansApplicationType.getVersion(NetBeansApplicationType.java:78)
	at com.sun.tools.visualvm.application.type.NetBeansApplicationType.getName(NetBeansApplicationType.java:57)
	at com.sun.tools.visualvm.profiling.presets.ProfilerPresets.createSelector(ProfilerPresets.java:103)
	at com.sun.tools.visualvm.profiler.ApplicationProfilerView.createSelector(ApplicationProfilerView.java:102)
	at com.sun.tools.visualvm.profiler.ApplicationProfilerView.access$200(ApplicationProfilerView.java:64)
	at com.sun.tools.visualvm.profiler.ApplicationProfilerView$2.createSelector(ApplicationProfilerView.java:96)
	at com.sun.tools.visualvm.profiler.MemorySettingsSupport.createPanel(MemorySettingsSupport.java:60)
	at com.sun.tools.visualvm.profiler.MemorySettingsSupport.getDetailsView(MemorySettingsSupport.java:30)
	at com.sun.tools.visualvm.profiler.ApplicationProfilerView.createComponent(ApplicationProfilerView.java:123)
	at com.sun.tools.visualvm.core.ui.DataSourceView.getView(DataSourceView.java:164)
	at com.sun.tools.visualvm.core.ui.DataSourceWindowTabbedPane$ViewContainer.<init>(DataSourceWindowTabbedPane.java:551)
	at com.sun.tools.visualvm.core.ui.DataSourceWindowTabbedPane.addViewTab(DataSourceWindowTabbedPane.java:86)
	at com.sun.tools.visualvm.core.ui.DataSourceWindow.addView(DataSourceWindow.java:69)
	at com.sun.tools.visualvm.core.ui.DataSourceWindowManager$7.run(DataSourceWindowManager.java:247)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:688)
	at java.awt.EventQueue$3.run(EventQueue.java:686)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:125)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
INFO [com.sun.tools.visualvm.attach.AttachModelImpl]: takeHeapHistogram
java.io.IOException: Zugriff verweigert
	at sun.tools.attach.WindowsVirtualMachine.openProcess(Native Method)
	at sun.tools.attach.WindowsVirtualMachine.<init>(WindowsVirtualMachine.java:56)
	at sun.tools.attach.WindowsAttachProvider.attachVirtualMachine(WindowsAttachProvider.java:69)
	at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
	at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:104)
Caused: java.io.IOException: Zugriff verweigert
	at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:106)
[catch] at com.sun.tools.visualvm.attach.AttachModelImpl.takeHeapHistogram(AttachModelImpl.java:91)
	at com.sun.tools.visualvm.attach.AttachModelImpl.takeHeapHistogram(AttachModelImpl.java:22)
	at com.sun.tools.visualvm.sampler.SamplerImpl$12.run(SamplerImpl.java:620)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1372)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1952)
WARNING [com.sun.tools.visualvm.sampler.SamplerImpl]: attachModel.takeHeapHistogram() returns null for Application [id: localhost-6936, pid: 6936, host: localhost]


My configuration:
Product Version: NetBeans IDE 7.3.1 (Build 201304162201)
Product Version: NetBeans IDE Dev (Build 201306100004)
Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01
Java: 1.6.0_43; Java HotSpot(TM) Client VM 20.14-b01
System: Windows XP version 5.1 running on x86; Cp1252; de_DE (nb)
JVisualVM 1.7.0_17 (Build 1342-120605); platform 20120605-unknown-revn
Comment 1 markiewb 2013-06-11 11:54:09 UTC
FYI: It also doesn't work with Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01 (neither with NB731 nor NB74Dev)
Comment 2 Jiri Skrivanek 2013-06-12 09:46:53 UTC
For me it works. I tried to attach to an external java application and also with the following steps:

- create new project "Samples|Java|Anagram Game"
- run project
- Attach profiler and it works

Please, could you try this simple scenario?

Product Version: NetBeans IDE Dev (Build 201306112301)
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b14
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 3 markiewb 2013-06-12 21:59:27 UTC
(In reply to comment #2)
> For me it works. I tried to attach to an external java application and also
> with the following steps:
> 
> - create new project "Samples|Java|Anagram Game"
> - run project
> - Attach profiler and it works
> 
> Please, could you try this simple scenario?
> 
> Product Version: NetBeans IDE Dev (Build 201306112301)
> Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
> Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b14
> System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)

I will try to reproduce the issue at my (and my coworker's) computer within the next days.

@Jiri: 
a) Have you tried WinXP 32bit? 
b) related to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7020052 ?
Comment 4 Jiri Skrivanek 2013-06-13 07:22:25 UTC
Yes, it works for me on WindowsXP as well.

Product Version: NetBeans IDE Dev (Build 201306122301)
Java: 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b02
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b31
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 5 Tomas Hurka 2013-06-13 07:48:45 UTC
It looks to me like JDK issue anyway, but If you are able to find reproducible test-case, we will be happy to investigate it and pass the information to JDK team.
Comment 6 markiewb 2013-06-13 11:51:01 UTC
(In reply to comment #4)
> Yes, it works for me on WindowsXP as well.
> 
> Product Version: NetBeans IDE Dev (Build 201306122301)
> Java: 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b02
> Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b31
> System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

Thanks for trying. I tried it at another computer with similar configuration to mine and it also doesn't work.

Product Version: NetBeans IDE 7.3.1 (Build 201306052037) 
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01 
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11 
System: Windows XP version 5.1 running on x86; Cp1252; de_DE (nb) 

I like to provide you more information, but 
* Where can I download 1.7.0_25?
* Where/How can I enable logging for the JDK, so that it prints out more info?
* Where/How can I enable logging for the NetBeans Profiler, so that it prints out more info?
Comment 7 Tomas Hurka 2013-06-14 13:19:41 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > Yes, it works for me on WindowsXP as well.
> > 
> > Product Version: NetBeans IDE Dev (Build 201306122301)
> > Java: 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b02
> > Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b31
> > System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
> 
> Thanks for trying. I tried it at another computer with similar configuration to
> mine and it also doesn't work.
> 
> Product Version: NetBeans IDE 7.3.1 (Build 201306052037) 
> Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01 
> Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11 
> System: Windows XP version 5.1 running on x86; Cp1252; de_DE (nb) 
> 
> I like to provide you more information, but 
> * Where can I download 1.7.0_25?
> * Where/How can I enable logging for the JDK, so that it prints out more info?
I don't see anything useful in JDK, which can provide more info.

> * Where/How can I enable logging for the NetBeans Profiler, so that it prints
> out more info?
I don't think logging on NetBeans site will help us, since the problem is how JDK calls native Windows code. 

Maybe Windows Eventlog viewer or ProcessMonitor <http://technet.microsoft.com/en-us/sysinternals/bb896645> can provide some more info.
Comment 8 markiewb 2013-06-17 16:18:25 UTC
(In reply to comment #7)
> I don't think logging on NetBeans site will help us, since the problem is how
> JDK calls native Windows code. 
> 
> Maybe Windows Eventlog viewer or ProcessMonitor
> <http://technet.microsoft.com/en-us/sysinternals/bb896645> can provide some
> more info.

I will have a look the next time I am in office.

BTW: Not reproducible using WinXP-Mode of Win7

Product Version: NetBeans IDE 7.3.1 (Build 201306052037)
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Windows XP version 5.1 running on x86; Cp1252; de_DE (nb)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo