web-dev-qa-db-ja.com

Java VisualVMがEclipseから起動されたローカルプロセスへの接続をハングアップする

Jdk1.7.0_04でインストールされたjvisualvmをローカルで実行中のJavaプロセスに接続しようとしています。これを行うと、jvisualvmが左下にプロセスへの接続を示す進行状況バーを表示します。二度と応答しません。

Java接続しようとしているプロセスはまだ問題なく、通常どおり動作します。

1つのブロックされたスレッドを示すjstackを使用して、visualvmのスレッドダンプを取得できます。

AWT-EventQueue-0" prio=6 tid=0x04a1a000 nid=0x1110 waiting for monitor entry [0x062af000]
   Java.lang.Thread.State: BLOCKED (on object monitor)
        at com.Sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.Java:76)
        - waiting to lock <0x289584f0> (a com.Sun.tools.visualvm.jvmstat.application.JvmstatApplication)
        at com.Sun.tools.visualvm.core.datasource.descriptor.DataSourceDescriptorFactory.getDescriptor(DataSourceDescriptorFactory.Java:49)

Javaプロセスに接続できません。ユーザーの入力を待つだけの些細なプロセスでも接続できます。jdk1.6.0_32でも同じ問題が発生しました。

-これを発見して以来の更新は、Java Eclipseから起動するプロセスにのみ影響します。デバッグパースペクティブからEclipseを起動してプロセスプロパティを開くことができます。同じプロセスをコマンドプロンプト(Eclipseからコピーしたコマンドを使用)は、jvisualvmおよびjconsoleからの接続を許可します。

完全なスレッドダンプ:

2012-05-10 13:18:47
Full thread dump Java HotSpot(TM) Client VM (23.0-b21 mixed mode, sharing):

"Inactive RequestProcessor thread [Was:TimedSoftReference/org.openide.util.TimedSoftReference]" daemon prio=2 tid=0x00e12800 nid=0xa5c in Object.wait() [0x0587f000]
Java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x22d6a578> (a Java.lang.Object)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.Java:1880)
    - locked <0x22d6a578> (a Java.lang.Object)

Locked ownable synchronizers:
    - None

"pool-4-thread-1" prio=6 tid=0x063ddc00 nid=0x1a70 waiting on condition [0x0750f000]
Java.lang.Thread.State: WAITING (parking)
    at Sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x23440068> (a Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at Java.util.concurrent.locks.LockSupport.park(LockSupport.Java:186)
    at Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.Java:2043)
    at Java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.Java:442)
    at Java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.Java:1043)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1103)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:603)
    at Java.lang.Thread.run(Thread.Java:722)

Locked ownable synchronizers:
    - None

"pool-3-thread-1" prio=6 tid=0x00fe7400 nid=0x16a0 waiting on condition [0x05a7f000]
Java.lang.Thread.State: WAITING (parking)
    at Sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x28a7ccd8> (a Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at Java.util.concurrent.locks.LockSupport.park(LockSupport.Java:186)
    at Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.Java:2043)
    at Java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.Java:442)
    at Java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.Java:1043)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1103)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:603)
    at Java.lang.Thread.run(Thread.Java:722)

Locked ownable synchronizers:
    - None

"Timer-1" daemon prio=2 tid=0x04c63800 nid=0x1f00 in Object.wait() [0x07f1f000]
Java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x289e6688> (a Java.util.TaskQueue)
    at Java.util.TimerThread.mainLoop(Timer.Java:552)
    - locked <0x289e6688> (a Java.util.TaskQueue)
    at Java.util.TimerThread.run(Timer.Java:505)

Locked ownable synchronizers:
    - None

"TimerQueue" daemon prio=6 tid=0x04b82c00 nid=0x124 waiting on condition [0x070df000]
Java.lang.Thread.State: TIMED_WAITING (parking)
    at Sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x285f8b20> (a Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at Java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.Java:226)
    at Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.Java:2082)
    at Java.util.concurrent.DelayQueue.take(DelayQueue.Java:220)
    at javax.swing.TimerQueue.run(TimerQueue.Java:171)
    at Java.lang.Thread.run(Thread.Java:722)

Locked ownable synchronizers:
    - <0x2862c110> (a Java.util.concurrent.locks.ReentrantLock$NonfairSync)

"Thread-3" daemon prio=6 tid=0x04b7b400 nid=0x1c18 in Object.wait() [0x06edf000]
Java.lang.Thread.State: WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x28562950> (a Java.util.LinkedList)
    at Java.lang.Object.wait(Object.Java:503)
    at Java.util.prefs.AbstractPreferences$EventDispatchThread.run(AbstractPreferences.Java:1476)
    - locked <0x28562950> (a Java.util.LinkedList)

Locked ownable synchronizers:
    - None

"DataSourceWindowManager Processor" daemon prio=2 tid=0x04b28c00 nid=0x11e0 runnable [0x06cdf000]
Java.lang.Thread.State: RUNNABLE
    at Sun.tools.attach.WindowsVirtualMachine.connectPipe(Native Method)
    at Sun.tools.attach.WindowsVirtualMachine.execute(WindowsVirtualMachine.Java:100)
    at Sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.Java:58)
    at Sun.tools.attach.HotSpotVirtualMachine.loadAgentLibrary(HotSpotVirtualMachine.Java:79)
    at Sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.Java:103)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelImpl$LocalVirtualMachine.loadManagementAgent(JmxModelImpl.Java:676)
    - locked <0x23440218> (a com.Sun.tools.visualvm.jmx.impl.JmxModelImpl$LocalVirtualMachine)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelImpl$LocalVirtualMachine.startManagementAgent(JmxModelImpl.Java:633)
    - locked <0x23440218> (a com.Sun.tools.visualvm.jmx.impl.JmxModelImpl$LocalVirtualMachine)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.tryConnect(JmxModelImpl.Java:450)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelImpl$ProxyClient.connect(JmxModelImpl.Java:420)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelImpl.connect(JmxModelImpl.Java:200)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelImpl.<init>(JmxModelImpl.Java:170)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.Java:45)
    at com.Sun.tools.visualvm.jmx.impl.JmxModelProvider.createModelFor(JmxModelProvider.Java:22)
    at com.Sun.tools.visualvm.core.model.ModelFactory.getModel(ModelFactory.Java:91)
    - locked <0x289f8fe0> (a com.Sun.tools.visualvm.jvmstat.application.JvmstatApplication)
    at com.Sun.tools.visualvm.tools.jmx.JmxModelFactory.getJmxModelFor(JmxModelFactory.Java:49)
    at com.Sun.tools.visualvm.application.views.threads.ApplicationThreadsViewProvider.resolveThreads(ApplicationThreadsViewProvider.Java:63)
    at com.Sun.tools.visualvm.application.views.threads.ApplicationThreadsViewProvider.supportsViewFor(ApplicationThreadsViewProvider.Java:29)
    at com.Sun.tools.visualvm.application.views.threads.ApplicationThreadsViewProvider.supportsViewFor(ApplicationThreadsViewProvider.Java:25)
    at com.Sun.tools.visualvm.core.ui.DataSourceViewsManager.getViews(DataSourceViewsManager.Java:116)
    at com.Sun.tools.visualvm.core.ui.DataSourceWindowManager.openWindowAndAddView(DataSourceWindowManager.Java:169)
    at com.Sun.tools.visualvm.core.ui.DataSourceWindowManager.access$000(DataSourceWindowManager.Java:30)
    at com.Sun.tools.visualvm.core.ui.DataSourceWindowManager$1.run(DataSourceWindowManager.Java:80)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.Java:1385)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.Java:1929)

Locked ownable synchronizers:
    - None

"AWT-EventQueue-0" prio=6 tid=0x049fa000 nid=0x1b90 waiting on condition [0x062af000]
Java.lang.Thread.State: WAITING (parking)
    at Sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x28310488> (a Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at Java.util.concurrent.locks.LockSupport.park(LockSupport.Java:186)
    at Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.Java:2043)
    at Java.awt.EventQueue.getNextEvent(EventQueue.Java:511)
    at Java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.Java:213)
    at Java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.Java:163)
    at Java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.Java:151)
    at Java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.Java:147)
    at Java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.Java:139)
    at Java.awt.EventDispatchThread.run(EventDispatchThread.Java:97)

Locked ownable synchronizers:
    - None

"AWT-Windows" daemon prio=6 tid=0x049cc000 nid=0x12b0 runnable [0x0608f000]
Java.lang.Thread.State: RUNNABLE
    at Sun.awt.windows.WToolkit.eventLoop(Native Method)
    at Sun.awt.windows.WToolkit.run(WToolkit.Java:299)
    at Java.lang.Thread.run(Thread.Java:722)

Locked ownable synchronizers:
    - None

"AWT-Shutdown" prio=6 tid=0x049cb400 nid=0x1954 in Object.wait() [0x05e8f000]
Java.lang.Thread.State: WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x28430620> (a Java.lang.Object)
    at Java.lang.Object.wait(Object.Java:503)
    at Sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.Java:287)
    - locked <0x28430620> (a Java.lang.Object)
    at Java.lang.Thread.run(Thread.Java:722)

Locked ownable synchronizers:
    - None

"Java2D Disposer" daemon prio=10 tid=0x010a4000 nid=0x1dd4 in Object.wait() [0x05c8f000]
Java.lang.Thread.State: WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x28378258> (a Java.lang.ref.ReferenceQueue$Lock)
    at Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:135)
    - locked <0x28378258> (a Java.lang.ref.ReferenceQueue$Lock)
    at Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:151)
    at Sun.Java2d.Disposer.run(Disposer.Java:145)
    at Java.lang.Thread.run(Thread.Java:722)

Locked ownable synchronizers:
    - None

"CLI Requests Server" daemon prio=6 tid=0x01058000 nid=0x1a58 runnable [0x0567f000]
Java.lang.Thread.State: RUNNABLE
    at Java.net.TwoStacksPlainSocketImpl.socketAccept(Native Method)
    at Java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.Java:398)
    at Java.net.PlainSocketImpl.accept(PlainSocketImpl.Java:183)
    - locked <0x28378700> (a Java.net.SocksSocketImpl)
    at Java.net.ServerSocket.implAccept(ServerSocket.Java:522)
    at Java.net.ServerSocket.accept(ServerSocket.Java:490)
    at org.netbeans.CLIHandler$Server.run(CLIHandler.Java:1042)

Locked ownable synchronizers:
    - None

"Active Reference Queue Daemon" daemon prio=2 tid=0x01028c00 nid=0x17b4 in Object.wait() [0x049af000]
Java.lang.Thread.State: WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x28378878> (a Java.lang.ref.ReferenceQueue$Lock)
    at Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:135)
    - locked <0x28378878> (a Java.lang.ref.ReferenceQueue$Lock)
    at org.openide.util.lookup.implspi.ActiveQueue$Impl.run(ActiveQueue.Java:64)
    at Java.lang.Thread.run(Thread.Java:722)

Locked ownable synchronizers:
    - None

"Timer-0" daemon prio=6 tid=0x01015400 nid=0x1ce8 in Object.wait() [0x047af000]
Java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x28378910> (a Java.util.TaskQueue)
    at Java.util.TimerThread.mainLoop(Timer.Java:552)
    - locked <0x28378910> (a Java.util.TaskQueue)
    at Java.util.TimerThread.run(Timer.Java:505)

Locked ownable synchronizers:
    - None

"Service Thread" daemon prio=6 tid=0x00e7b400 nid=0x4a8 runnable [0x00000000]
Java.lang.Thread.State: RUNNABLE

Locked ownable synchronizers:
    - None

"C1 CompilerThread0" daemon prio=10 tid=0x00e76000 nid=0x13e0 waiting on condition [0x00000000]
Java.lang.Thread.State: RUNNABLE

Locked ownable synchronizers:
    - None

"Attach Listener" daemon prio=10 tid=0x00e74400 nid=0x448 waiting on condition [0x00000000]
Java.lang.Thread.State: RUNNABLE

Locked ownable synchronizers:
    - None

"Signal Dispatcher" daemon prio=10 tid=0x00e73000 nid=0x1eb4 runnable [0x00000000]
Java.lang.Thread.State: RUNNABLE

Locked ownable synchronizers:
    - None

"Finalizer" daemon prio=8 tid=0x00e60400 nid=0x1f28 in Object.wait() [0x03b1f000]
Java.lang.Thread.State: WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x28378b58> (a Java.lang.ref.ReferenceQueue$Lock)
    at Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:135)
    - locked <0x28378b58> (a Java.lang.ref.ReferenceQueue$Lock)
    at Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:151)
    at Java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.Java:177)

Locked ownable synchronizers:
    - None

"Reference Handler" daemon prio=10 tid=0x00e5ec00 nid=0x1d40 in Object.wait() [0x0391f000]
Java.lang.Thread.State: WAITING (on object monitor)
    at Java.lang.Object.wait(Native Method)
    - waiting on <0x283782e8> (a Java.lang.ref.Reference$Lock)
    at Java.lang.Object.wait(Object.Java:503)
    at Java.lang.ref.Reference$ReferenceHandler.run(Reference.Java:133)
    - locked <0x283782e8> (a Java.lang.ref.Reference$Lock)

Locked ownable synchronizers:
    - None

"main" prio=6 tid=0x00db8000 nid=0x12f0 waiting on condition [0x00000000]
Java.lang.Thread.State: RUNNABLE

Locked ownable synchronizers:
    - None

"VM Thread" prio=10 tid=0x00e5d000 nid=0xbf8 runnable 

"VM Periodic Task Thread" prio=10 tid=0x00e7e800 nid=0x1fcc waiting on condition 

JNI global references: 656
38
lukestevo

ネットワーク構成を確認してください。

同じ問題が発生しました。 「プロキシなし」でネットワーク構成を設定すると機能します。メインメニュー:tools/options/network/no proxy

23
user1529053

これはVisualVMメーリングリストで見つかりました: https://Java.net/projects/visualvm/lists/users/archive/2016-06/message/7

これを追加しました:

-J-Dorg.netbeans.profiler.separateConsole=true

私のjvisualvm.exeショートカットに、それは動作します!

18
Jwood48

次のVM引数を「実行構成」に追加してみてください。

-Djava.rmi.server.hostname=localhost

Run configuration

16
nybon

同じ問題が発生しており、プロキシの背後にいます。 「プロキシなし」または「手動プロキシ設定」を選択すると、問題が解決します。

とても簡単なことで、これに数時間も無駄にしています...

5
Joseph Carroll

私の場合、解決策は32ビットのjsdkを使用することでした。
診断するには、jvisualvmをparam --trace ..

私のログに含まれていた:
Cannot load C:\Program Files\Java\jdk1.7.0_45\jre\bin\server\jvm.dll. %1 is not a valid Win32 application. (193) Falling back to running Java in a separate process; DLL cannot be loaded (64-bit DLL?).

5

ときどき、Skypeが奇妙なポートに置かれています...これにより、8080を選択したときに、少なくとも2つの大きな頭痛の種が発生し、Tomcatが破損していると思いました。 Skypeがそのポートを使用していることが判明しました(1時間ほど経ってから、完全に無知で無防備になった)。

また、質問:プログラムをEclipseから「実行」または「デバッグ」モードで起動しましたか?

1
ppeterka

eclipseのrunConfigurations拡張タブに次の引数を追加します

-XX:+ StartAttachListener

これにより、visualVMが即座に接続し、サンプルとプロファイリングが機能します。

0
daedalus