jvisualvm: Software caused connection abort: socket write error - java

When I want to profile a java programm started from eclipse with jvisualvm 1.3.8 I get the error message within eclipse console:
Software caused connection abort: socket write error.
This also happens when I start the program without eclipse (java -jar ...) from command line console. I tested jvisualvm from JDK 1.8.0_20 and downloaded the newest version 1.3.8. Here is the stacktrace:
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 15)
Profiler Agent: Established connection with the tool
Profiler Agent: Local accelerated session
Profiler Agent: Connection with agent closed
Profiler Agent Error: Exception when trying to send response or command to client:
java.net.SocketException: Software caused connection abort: socket write error
*** Profiler engine warning: class load hook invoked at inappropriate time for java.lang.Throwable$PrintStreamOrWriter, loader = null
*** This class will not be instrumented unless you re-run the instrumentation command
*** Please report this problem to feedback#profiler.netbeans.org
=============================== Stack trace =====================
*** Profiler engine warning: class load hook invoked at inappropriate time for java.lang.Throwable$WrappedPrintStream, loader = null
*** This class will not be instrumented unless you re-run the instrumentation command
*** Please report this problem to feedback#profiler.netbeans.org
=============================== Stack trace =====================
*** Profiler engine warning: class load hook invoked at inappropriate time for java.util.IdentityHashMap$KeySet, loader = null
*** This class will not be instrumented unless you re-run the instrumentation command
*** Please report this problem to feedback#profiler.netbeans.org
=============================== Stack trace =====================
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.util.IdentityHashMap.keySet(IdentityHashMap.java:976)
at java.util.Collections$SetFromMap.<init>(Collections.java:5512)
at java.util.Collections.newSetFromMap(Collections.java:5496)
at java.lang.Throwable.printStackTrace(Throwable.java:650)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at org.netbeans.lib.profiler.server.ProfilerServer.handleIOExceptionOnSend(ProfilerServer.java:1698)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:706)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
=============================== End stack trace =================
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at java.lang.Throwable.printStackTrace(Throwable.java:634)
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at org.netbeans.lib.profiler.server.ProfilerServer.handleIOExceptionOnSend(ProfilerServer.java:1698)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:706)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
=============================== End stack trace =================
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1329)
at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:912)
at java.lang.Throwable.printStackTrace(Throwable.java:643)
at org.netbeans.lib.profiler.server.ProfilerServer.handleIOExceptionOnSend(ProfilerServer.java:1698)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:706)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
=============================== End stack trace =================
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeBytes(ObjectOutputStream.java:1985)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:2168)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:2007)
at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:869)
at org.netbeans.lib.profiler.wireprotocol.RootClassLoadedCommand.writeObject(RootClassLoadedCommand.java:159)
at org.netbeans.lib.profiler.wireprotocol.WireIO.sendComplexCommand(WireIO.java:301)
at org.netbeans.lib.profiler.server.ProfilerServer.sendComplexCmdToClient(ProfilerServer.java:703)
at org.netbeans.lib.profiler.server.ProfilerInterface.sendRootClassLoadedCommand(ProfilerInterface.java:1418)
at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:232)
at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:137)
Profiler Agent Error: Exception when handling command from client:
java.net.SocketException: Software caused connection abort: recv failed
Profiler Agent: Connection with agent closed
After this the port 5140 is opened by my application to be profiled. I googled a lot and could not find any help with this. I also wrote another simple program and the error occured as well.
What can I do?

I've encountered this a few times. What OS platform are you running this on? Windows? or *nix?
On Windows, you'll almost certainly need to run your Eclipse and/or the jvisualvm using Admin privs...I typically set up a command prompt, Run As ... Administrator.
On Linux, you'll need to be running Eclipse and/or jvisualvm as either root or with an account that has privs that match or exceed the account running the pid you are trying to monitor.

This is definitely a firewall issue. Most likely you will not have rights to disable your firewall if an OS is not asking you (Windows). In my case I had eventually ran the application on another box where I had rights to allow JVisualVM to connect to my application.

Related

Hadoop: Unable to load native-hadoop library for your platform. using builtin-java classes > where applicable

I am trying to configure hadoop and format namenode using this command:
$ hdfs namenode -format
However, I keep getting this error. How can I fix it?
2017-06-20 12:22:25,792 WARN util.NativeCodeLoader: Unable to load
native-hadoop library for your platform... using builtin-java classes
where applicable ^[[A2017-06-20 12:22:28,825 WARN ipc.Client: Failed
to connect to server: localhost/127.0.0.1:9000: try once and fail.
java.net.ConnectException: Connection refused at
sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at
org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531) at
org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495) at
org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:681)
at
org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:777)
at
org.apache.hadoop.ipc.Client$Connection.access$3500(Client.java:408)
at org.apache.hadoop.ipc.Client.getConnection(Client.java:1542) at
org.apache.hadoop.ipc.Client.call(Client.java:1373) at
org.apache.hadoop.ipc.Client.call(Client.java:1337) at
org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:227)
at
org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:115)
at com.sun.proxy.$Proxy11.getFileInfo(Unknown Source) at
org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:812)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:398)
at
org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeMethod(RetryInvocationHandler.java:163)
at
org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invoke(RetryInvocationHandler.java:155)
at
org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeOnce(RetryInvocationHandler.java:95)
at
org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:335)
at com.sun.proxy.$Proxy12.getFileInfo(Unknown Source) at
org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:1638) at
org.apache.hadoop.hdfs.DistributedFileSystem$27.doCall(DistributedFileSystem.java:1367)
at
org.apache.hadoop.hdfs.DistributedFileSystem$27.doCall(DistributedFileSystem.java:1364)
at
org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at
org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1379)
at org.apache.hadoop.fs.Globber.getFileStatus(Globber.java:64) at
org.apache.hadoop.fs.Globber.doGlob(Globber.java:269) at
org.apache.hadoop.fs.Globber.glob(Globber.java:148) at
org.apache.hadoop.fs.FileSystem.globStatus(FileSystem.java:1960) at
org.apache.hadoop.fs.shell.PathData.expandAsGlob(PathData.java:326)
at
org.apache.hadoop.fs.shell.Command.expandArgument(Command.java:239)
at
org.apache.hadoop.fs.shell.Command.expandArguments(Command.java:222)
at
org.apache.hadoop.fs.shell.FsCommand.processRawArguments(FsCommand.java:103)
at org.apache.hadoop.fs.shell.Command.run(Command.java:166) at
org.apache.hadoop.fs.FsShell.run(FsShell.java:326) at
org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76) at
org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:90) at
org.apache.hadoop.fs.FsShell.main(FsShell.java:389) ls: Call From
ubuntu/127.0.1.1 to localhost:9000 failed on connection exception:
java.net.ConnectException: Connection refused; For more details see:
http://wiki.apache.org/hadoop/ConnectionRefused \ERROR: JAVA_HOME
/opt/jdk1.8.0_91/ does not exist.
2017-06-20 12:22:25,792 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Apache Hadoop can integrate with an optional native library that contains extensions implementing deeper OS integration and performance enhancements for certain features. For more details, refer to the documentation page Native Libraries Guide.
In many cases for client-side usage or developer setups, the native library extensions are optional. However, the log warning can be a nuisance. If you'd like to get it out of the way, there are a few options:
Some Apache Hadoop releases include a pre-built native library. You could potentially use this. This bundled library would use whatever OS/architecture executed the Apache Hadoop release build, so there is no guarantee that it will match your own OS/architecture. Do not attempt to mix and match different versions of Hadoop code and native code or you may see unusual linkage errors.
Build the native library yourself. This would guarantee the build matches your actual runtime OS/architecture. In addition to the documentation page linked above, there are more specific instructions on how to build in the BUILDING.txt file. Again, it's important to match the version of the Hadoop code and native code.
If you use a commercial vendor's distro, then they likely have taken care of guaranteeing the native library is already set up and deployed correctly.
If all else fails, you can stifle the warning by adding the following to log4j.properties
log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR
org.apache.hadoop.fs.FsShell.main(FsShell.java:389) ls: Call From ubuntu/127.0.1.1 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
This is a different error, unrelated to the native code loader warning. This indicates that the client failed to connect to the NameNode during command execution. This can be caused by lack of network connectivity or simply the NameNode daemon is not running. The linked wiki page in the error message has more details on troubleshooting this.
ERROR: JAVA_HOME /opt/jdk1.8.0_91/ does not exist.
I'm not sure exactly where this message came from, but it's self-explanatory. Either check that you have Java deployed at that path, or change JAVA_HOME to the correct path.

The native JNI Library 'mqjbnd' was not found. For a client installation this is expected (3=mqjbnd)

I am using Websphere V8.5 in RAD. While trying to create queue connection Getting the following error. If i am testing the same code in standard java application getting the connection object. But in webapplication it is not working.
Here is my code
MQQueueconnectionFactory factory=new MQQueueconnectionFactory();
factory.setHostName(HostName);
factory.setTransportType(1);
factory.setPort(1414);
factory.setChannel(ChannelName);
factory.setQueueManager(Queuemanagername);
connection=factory.createQueueConnection();
connection.start();
Error
"Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. [3=mqjbnd]
Caused by: java.lang.UnsatisfiedLinkError: no mqjbnd in java.library.path
Error Log
Thanks in advance.
Set 'client mode' if you write client, more
factory.setIntProperty(CommonConstants.WMQ_CONNECTION_MODE, CommonConstants.WMQ_CM_CLIENT);
Configure libraries if you start in default XMSC_WMQ_CM_BINDINGS mode.

I can't run Scada-Lts, WebappClassLoaderBase and ViewGraphicLoader classes errors

When I tried to run Scada-Lts on Tomcat 8.0.24 I got the following error:
23-Sep-2016 11:03:27.228 INFO [Timer-0] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [java.util.ListIterator]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [java.util.ListIterator]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1335)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1321)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1203)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164)
at org.apache.commons.pool.impl.GenericObjectPool.evict(GenericObjectPool.java:981)
at org.apache.commons.pool.impl.GenericObjectPool$Evictor.run(GenericObjectPool.java:1112)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
and a lots of error like:
WARN 2016-09-23 11:03:17,125 (com.serotonin.mango.view.ViewGraphicLoader.loadViewGraphics:58) - Failed to load image set at C:\Users\xxx\Desktop\GitHubProjects\Scada-LTS\out\artifacts\scadabr_1_1_0_RC_war_exploded\graphics\Weather
java.lang.Exception: Unable to derive image dimensions
Somebody knows why I got those errors?
Please run Scada-LTS on tomcat7.
Scada-LTS have not been migrated to tomcat8 (migrating)
I mean the problem is paths in app Scada-LTS.

Intermittent JUnit error - java virtual machine connection refused

I'm getting intermittent JUnit 4 errors in our Jenkins build system. The test passes after re-running it. The test is started by Maven and uses JMockit for mock objects.
The root cause of the exception comes from the VM:
Caused by: java.io.IOException: Connection refused
at sun.tools.attach.LinuxVirtualMachine.connect(Native Method)
at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:124)
Anyone experienced this and found a solution?
Looks like its a bug in the JVM http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6649594
The workaround was to pass a JVM argument:
-XX:+StartAttachListener
and the tests stopped failing.

Unable to get thread dump? Any ideas why my app blocks?

I have a basic java server app that has 100 worker threads that do simple HEAD requests on urls. I'm using HttpClient 4.x for this.
A few minutes into the run my program just freezes for a couple minutes and I cannot figure out why. Check out the screen shot of what visual vm monitor reports. You can see it flatline. During this time I'm unable to get a good thread dump and visual vm just freezes until it's unblocked. Does anyone have any ideas on what I can do to try and start debugging this guy?
Visual VM: http://tinypic.com/view.php?pic=2i915bs&s=7
Here is the output when I tried to take a jstack dump while it was frozen:
jstack -F 4325
Attaching to process ID 4325, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 16.3-b01
Deadlock Detection:
No deadlocks found.
Thread 4557: (state = BLOCKED)
Error occurred during stack walking:
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:152)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebuggerLocal.java:466)
at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:65)
at sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess.getCurrentFrameGuess(LinuxAMD64JavaThreadPDAccess.java:92)
at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:256)
at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:218)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:76)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:45)
at sun.jvm.hotspot.tools.JStack.run(JStack.java:60)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:221)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.tools.jstack.JStack.runJStackTool(JStack.java:118)
at sun.tools.jstack.JStack.main(JStack.java:84)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:51)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(LinuxDebuggerLocal.java:460)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:127)
I've seen several bug reports about jstack on Linux with a similar trace:
JVM Bug Id: 6494722 (is supposed to be fixed)
Ubuntu Bug #597098 (this one is not)
Do you get the same result with a kill -3 <pid>?
Very likley due to too much memory usage causing GC. Add the params to java:
-verbosegc -XX:+PrintGCDetails
And see if you notice anything obvious in the output/logs
What worked for me was running jstack as the process owner without -F.

Categories

Resources