JVM: Can't detect initial thread stack location - find_vma failed - java

The compilation was successful
The multiplication should have been performed at compile time without any code being generated.
However, your solution generated the following code:
Java HotSpot(TM) 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed
mov ax,5
mov ax,6
mul ax
[ the expected value was 30, but you calculated the result as 6 ]
I entered some code in my school's system and I got this error message. I don't understand the part where it says "The multiplication should have been performed at compile time without any code being generated.".
Anyone know what I might be doing wrong?
(I can't reveal the code I entered in it, because I don't want it showing up in a search engine. Is there a way I can privately show the code I entered in?)

On my Ubuntu 10.04/64-bit system, java was unable to access the /proc filesystem.
Specifically, I was running in a chroot which didn't have it mounted:
mount -t proc none /proc

I encountered the same problem in my chroot environment. As #chronospoon suggested, it is because java was unable to access the /proc filesystem.
However, the correct mounting command is the following (note that both proc does not prefixed by /), as mentioned in here:
mount -t proc none proc
To check whether the mounting is successful, just check whether the proc directory has any file.

The message "Can't detect initial thread stack location" is quite common, see e.g., here and here. The remaining part is strange, the assembly code is pure nonsense. I wouldn't care about that, it isn't your fault.

The Can't detect initial thread stack location suggests an incomplete or corrupt Java installation.
The stuff about multiplication at compile time doesn't look like it comes from Java, but instead from some sort of IDE or compilation tool that your school is using. Whatever this "school system" is, you need to ask whoever is responsible for it about these error messages.

I suspect that this is an artifact of the "school system" that you are using, which appears to be some framework for automating code testing.
The message looks system specific to me.
If the message is no system specific, it is a (arguably) a bug for a production application to be reporting obscure HotSpot errors to end users.
So, I think you should be asking the people who manage the system, and (presumably) understand what that message means.

Related

What is JFR parameter filename meaning? File ends up being empty after exit

I have situation where I start JDK18 jvm from c++ code to produce vst plugin goal being to implement audio signal algorithms in java side with added value of full java GUI api. My framework works very smoothly apart from the repeatable state where my audio streaming crashes after 14 hours. So I thought this is good place to start learning JFR. My jvm starting parameters are in xml file and relevant part is:
<param>
-XX:StartFlightRecording,dumponexit=true,filename=c:/out/blackbox.jfr
</param>
Even when application exits that named file keeps empty. So what is the idea of filename parameter if it stays empty and how to use it?
The recording is dumped in a Java shutdown hook. If you terminate the C++ application with exit(status), the Java hook never gets a chance to run.
Not sure how to best run the shutdown hooks, but you could perhaps invoke System.exit(status) from native using CallStaticVoidMethod?
My solution with JDK 18 and flight recorder is not to use JVM startup options at all but instead use jcmd's JFR commands. This is due to incompatible JVM options at startup and lacking documentation. Available documentation is clearly for some older versions of JVM. Here is the available documentation:https://docs.oracle.com/javacomponents/jmc-5-5/jfr-command-reference/toc.htm which proposes use of -XX:+UnlockCommercialFeatures which has been long gone. What is current state of command line options is not achieveable for average programmer.
But "jcmd JFR.start" is example of things that work. I got things working observing with "jcmd PID JFR.check" . It is obvious that JFR api is also little bit broken and needs to addressed in a certain way to get the wanted results. There must have been very hurry when implementing it because the order of parameters is very crucial. And there is a nag that "name" must not be a number even it uses it as number. Now I know it is sensitive. So the way I want it to function is to sample and dump periodic chunks so that differences reveal them selves. Now I have the solution to that but it needs another question with no stupid complaints. Baseline is that jcmd with JFR parameter must be used as it comes out of the box in the way which is not obvious.

Can Java output variable names and data values in error logs?

(I'm not a Java programmer, just an end-user trying to deal with a lack of exception handling and reporting in someone else's code.)
Is there a way to get more detailed info such as variable names and values from Java when it back-traces an unhandled exception?
This is in regards to a Minecraft server log, apparently there's a corrupt chunk file somewhere. The error trace seems too vague to tell me exactly where the problem is located, such as the specific datafile name involved in the error.
2013-12-16 11:19:03 [WARNING] Failed to handle packet for PlayerName [/XX.XX.XX.XX:5046]: java.lang.ArrayIndexOutOfBoundsException: -448550
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.set(ArrayList.java:399)
at net.minecraft.world.chunk.storage.RegionFile.<init>(RegionFile.java:89)
at net.minecraft.world.chunk.storage.RegionFileCache.func_76550_a(SourceFile:61)
at net.minecraft.world.chunk.storage.AnvilChunkLoader.chunkExists(AnvilChunkLoader.java:63)
at net.minecraft.world.gen.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:167)
at net.minecraft.server.management.PlayerInstance.<init>(PlayerInstance.java:38)
at net.minecraft.server.management.PlayerManager.func_72690_a(PlayerManager.java:116)
at net.minecraft.server.management.PlayerManager.func_72683_a(PlayerManager.java:175)
at net.minecraft.server.management.ServerConfigurationManager.func_72375_a(ServerConfigurationManager.java:269)
at net.minecraft.server.management.ServerConfigurationManager.func_72377_c(ServerConfigurationManager.java:335)
at net.minecraft.server.management.ServerConfigurationManager.func_72355_a(ServerConfigurationManager.java:180)
at net.minecraft.network.NetLoginHandler.completeConnection(NetLoginHandler.java:218)
at cpw.mods.fml.common.network.FMLNetworkHandler.handleClientConnection(FMLNetworkHandler.java:171)
at cpw.mods.fml.common.network.FMLNetworkHandler.onConnectionReceivedFromClient(FMLNetworkHandler.java:124)
at net.minecraft.network.NetLoginHandler.func_72529_d(NetLoginHandler.java:194)
at net.minecraft.network.NetLoginHandler.func_72532_c(NetLoginHandler.java:81)
at net.minecraft.server.ServerListenThread.func_71766_a(ServerListenThread.java:57)
at net.minecraft.server.dedicated.DedicatedServerListenThread.func_71747_b(SourceFile:29)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:865)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:320)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:732)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:614)
at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:573)
From the logs, I understand that a player is trying to log on, and it's loading the world data where the player was last located, but a region file is corrupt and an array in the file data is invalid.
But which region file? It doesn't tell me that.
Can these error logs be made to be more verbose with variable names and values, such as with an extra startup java command line setting?
I'm finding very little to explain how to even interpret these back traces. I assume the numbers at the end of each line are referring to line numbers within the source code, but I'm not able to edit the code so examining the source at those lines would not help anyway.
Environment: Ubuntu 13.10
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.12) (7u25-2.3.12-4ubuntu3)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
You really want to learn how to use a source-level debugger. These will let you step through the code, stopping at interesting points or when an exception is thrown, and examine (and often even modify) variable values.
Which is best is very much a matter of taste, but I'm going to break the rule here and suggest you try the Eclipse environment simply because it's the only IDE I've ever used which really does a good job of integrating code authoring, debugging, and management.
(The Java runtime environment does have its own debugger, which can do most of the same things -- but it's a commandline tool and I think it's significantly harder for a novice to learn. There are times when it's the right tool, mostly when you have to work remotely over a very limited connection, but I don't suggest you start with it.)

Execution halts on "Microsoft Visual C++ Runtime Error"-popup

A project I am currently involved in uses JavaCv/OpenCv for face detection. Since the OpenCv occasionally throws an error, and the propagation of OpenCv/C++ errors to Java Exceptions isn't fully functional yet, this means the Java main-loop crashes with no way to recover.
However, the code gives mostly accurate results, and since we're running it on a large database I baked a quick Batch-script around the execution to keep it going, and the Java code internally manages an id, to make sure it continues from just after where it crashed.
:RETRY
java -Xmx1024m -jar Main.jar
IF ERRORLEVEL 1 GOTO RETRY
EXIT 0
However, occasionally I get a Runtime Error pop-up, as follows:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Windows\System32\java.exe
This application has requested the runtime to end in an unusual way.
Please contact the application's support team for more information.
At which point the code execution halts until the pop-up is clicked, which is really annoying, as it means my code can't run without me babysitting it.
I found this question, which basically asks the same thing. There is an accepted solution for that question, but since I'm not directly working with C++, I don't see how I can implement this.
Is there a Batch-level solution to this problem? Is there a Java/JavaCv-level solution to catch the C++ errors coming from OpenCv? Any other solution?
Interesting question.
Java.exe is dependent on one or more of Visual C++ DLLs (like MSVCRT.DLL, msvcr90.dll etc). Probably the JAR file is causing Java.exe to cause this error. Java.exe must be calling some CRT function which is raising the exception and hence the Runtime Error.
The best bet you can do is to launch the process, let this error pop and then start Process Explorer, and see the call stack. Nevertheless, solving this issue is most probably out of your control. May be latest version of Java may help.

Why does the Java VM update 25 crash with internal error

Since Java update 25 the VM crashes occasionally with internal error. With previous versions <25 it was working fine. According to the release notes, the hotspot compiler was modified in update 25. Does it produce defect code that causes the crash? It does not crash if the JIT compiler is turned off with -Xint. I filed a bug here http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7054478 .
How do I interpret the log file to find out where the crash occurs. I am not able to identify the lines in my Java code where it happenes.
I searched the Bug Database for the string "Unexpected result from topLevelExceptionFilter", and there were three other hits. They all seem to be about unexpected exceptions in native code propagating back across the JNI boundary.
Is that clue relevant to your application?
The reason is that an internal assertion failed - the JVM was not in the state it expected to be. This is a good thing because it avoids propagating errors, but a bad thing because it doesn't tell you how to get around it.
If simple tricks like -client or -server doesn't help, then consider a different JVM.
IBM has a Windows JVM, but it is a bit tricky to get. The easiest for now would be a development package http://www.ibm.com/developerworks/java/jdk/eclipse/index.html
Oracle also have JRockit. http://www.oracle.com/technetwork/middleware/jrockit/index.html
This will allow you to work while Oracle has a look at your bug. It is low priority though, so it make take a while.

What is the cause of JVM exit code 1073807364?

I've built a RCP-based application, and one of my users running on Windows XP, Sun JVM 1.6.0_12 had a full application crash. After the app was running for two days (and this is not a new version or anything), he got the nice gray JVM force exit box, with exit code=1073807364.
He was away from the machine at the time, and the only thing I can find near that time in the application logs was some communication with the database (SQL Server by way of Hibernate). There's no hs_ files or anything similar as far as I can tell. Web searching found a bunch of crash reports with that exit code in a variety of applications, but I didn't see any fundamental explanation of what causes it.
Can anyone tell me what causes it? Is there additional information likely to have been dumped that could prove useful?
From what I can tell, this error code (0x40010004) arises in all sorts of situations, with (as you noted) no obvious common thread.
However this page says "0x40010004" means "the task is running"! So, I would surmise that the correct way to interpret it is as saying "this tasked has exited in a way that prevented it setting a proper exit code".
I don't know if this will help, but I would try looking in the Windows Event logs to see if the problem is being reported there.

Categories