Just Enough Resources (JER)

Just Enough Resources (JER)

163M Downloads

Can't profile Crossroads dimensions / poor error handling

AntiBlueQuirk opened this issue ยท 10 comments

commented

Crossroads adds two dimensions (The Workspace and Prototype dimensions). These are special purpose dimensions, so they should really be added to the blacklist and not profiled, but that's not the bug I'm reporting. Something about the way Crossroads dimensions are set up causes the profiling thread to crash due to a thrown exception, at which point profiling just... stops. No error is displayed, and the profiling just never finishes. I think this is the wrong behavior, and the error should at least be sent the the user, with the dimension ID so they can blacklist it.

commented

@AntiBlueQuirk when it throws the error, does it look like the one in #134 ?

commented

It's similar, but I think this error shows up earlier in the thread while it's trying to get information about the world. I somehow missed it in the logs before, but I was able to reproduce it pretty easily.

[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: java.lang.IllegalArgumentException: Could not get provider type for dimension 568, does not exist
[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at net.minecraftforge.common.DimensionManager.getProviderType(DimensionManager.java:146)
[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at net.minecraftforge.common.DimensionManager.createProviderFor(DimensionManager.java:296)
[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at net.minecraft.world.WorldServer.<init>(WorldServer.java:110)
[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at jeresources.profiling.DummyWorld.<init>(DummyWorld.java:36)
[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at jeresources.profiling.Profiler.profileWorld(Profiler.java:63)
[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at jeresources.profiling.Profiler.run(Profiler.java:41)
[Thread-79/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at java.lang.Thread.run(Unknown Source)

This is JER 1.12.2-0.8.6.33, forge 14.23.1.2583. It happens when trying to do a /profile all. The process runs fine, until it tries to profile dimension 568. The chat doesn't even mention the world name, let alone that the profiler crashed.

As an experiment, if I try to teleport to 568 with /jtp (from JourneyMap), it reports "Could not get world for Dimension 568". I think that the dimension is registered with forge, but isn't actually created until it's needed. Or something like that. I'm not very familiar with the internals of how the dimension system works. The error from that is a little different, maybe the log will help you:

[Server thread/ERROR] [FML]: Cannot Hotload Dim: 568
java.lang.IllegalArgumentException: Could not get provider type for dimension 568, does not exist
	at net.minecraftforge.common.DimensionManager.getProviderType(DimensionManager.java:146) ~[DimensionManager.class:?]
	at net.minecraftforge.common.DimensionManager.initDimension(DimensionManager.java:233) [DimensionManager.class:?]
	at net.minecraft.server.MinecraftServer.func_71218_a(MinecraftServer.java:830) [MinecraftServer.class:?]
	at journeymap.common.action.JourneyMapTeleport.attemptTeleport(JourneyMapTeleport.java:60) [JourneyMapTeleport.class:1.12.2-5.6.0b1]
	at journeymap.common.command.CommandJTP.func_184881_a(CommandJTP.java:53) [CommandJTP.class:1.12.2-5.6.0b1]
commented

The current version of JER has a bug where it uses Dimension Type IDs for Dimension IDs. 99% of the time, mods use the same number for both.
Install TellMe https://minecraft.curseforge.com/projects/tellme?gameCategorySlug=mc-mods&projectID=225781
Run the command /tellme dump-csv dimensions and send back the resulting CSV file.
I am willing to bet that one of the dimensions listed has a dimension type id of 568 but is not in a dimension with that number.

commented

You mean like this? :)

"ID","DimensionType ID","Name","shouldLoadSpawn","WorldProvider class","Currently loaded"
-1,-1,"the_nether","false","WorldProviderHell","true"
27,568,"crossroads","false","PrototypeWorldProvider","true"
1,1,"the_end","false","WorldProviderEnd","true"
0,0,"overworld","true","WorldProviderSurface","true"
commented

Yup, I have a pull request in to fix that issue. The ID and Dimension Type ID don't match, so JER does something impossible.

commented

Yes, although I think it would be wise to catch exceptions in the run() function, possibly around the profileWorld() calls, because if something during profiling throws an exception, it just escapes out of that function and becomes an uncaught exception. The profiling thread terminates, and the exception appears in the logs, but profiling ends with no message to the user in game. If it wasn't a separate thread, that exception would crash the game. (Which admittedly, would be a much greater indication that something was wrong.)

commented

Okay, nice to know the bug has been found, though I still think the profiling thread should handle exceptions better, and present them to the user in chat with the rest of the profiling information.

commented

Got bitten by this same bug today, using Climatic's world generator. There's a (useless, granted) error in the logs, but nothing at all in chat; the profiler just moves on to the next world. I scratched my head for a while about why I had data for every world except the overworld.

commented

Not supporting 1.12 anymore, will have to rewrite profiling for newer versions.