CC: Tweaked

CC: Tweaked

57M Downloads

Random NoClassDefFoundError in Monitor code

Ai-Kiwi opened this issue ยท 19 comments

commented

Minecraft Version

1.16.x

Version

1.99.0

Details

it seems to be abit random when it happens sometimes when my friend tp to me. sometimes when i login server sometimes when i run computercraft dump. im not sure what else to add or what logs would help so i guess ask for them and ill deliver.

commented

Ran into this issue as stated in #1043.

Only after the first shut down of the server, upon a players connecting or running "help" on the server CLI.

I've absolutely no idea why this doesn't seem to happen to most people but happens to my reliably with every new world save.
Currently to pin point the root cause, will be back.

EDIT: Seems to be related to a computer running a startup script thats shell.run wgetting code updates from a webserver.

commented

im not sure what else to add or what logs would help so i guess ask for them and ill deliver.

Well, the crash log would be helpful :).

commented

can confirm i don't know if its because there old monitors but its a insta server crash when i break montiers.

commented

crash-2021-12-04_13.09.29-server.zip
keep in mind that these are 4 from today the problem has also happened yesterday.

commented

Two of these crashes are watchdog timeouts, which aren't a bug, but the other two are more suspicious:

java.lang.NoClassDefFoundError: dan200/computercraft/shared/peripheral/monitor/MonitorWatcher$PlayerUpdate
	at dan200.computercraft.shared.peripheral.monitor.MonitorWatcher.onWatch(MonitorWatcher.java:64) ~[computercraft:1.99.0] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_766_MonitorWatcher_onWatch_Watch.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}

and

java.lang.NoClassDefFoundError: dan200/computercraft/shared/peripheral/monitor/Expander
	at dan200.computercraft.shared.peripheral.monitor.TileMonitor.expand(TileMonitor.java:493) ~[computercraft:1.99.0] {re:classloading}
	at dan200.computercraft.shared.peripheral.monitor.TileMonitor.contractNeighbours(TileMonitor.java:515) ~[computercraft:1.99.0] {re:classloading}
	at dan200.computercraft.shared.peripheral.monitor.TileMonitor.destroy(TileMonitor.java:92) ~[computercraft:1.99.0] {re:classloading}

Both these are caused by the following suppressed exception which is thrown from https://github.com/cpw/modlauncher/blob/79b02cafbfe7879014de80c28f5526021f453009/src/main/java/cpw/mods/modlauncher/TransformingClassLoader.java#L253.

	Caused by: java.nio.channels.ClosedChannelException
		at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:150) ~[?:?] {}
		at sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:349) ~[?:?] {}
		at sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:52) ~[?:?] {}
		at jdk.nio.zipfs.ZipFileSystem.readFullyAt(ZipFileSystem.java:962) ~[jdk.zipfs:?] {}
		at jdk.nio.zipfs.ZipFileSystem.readFullyAt(ZipFileSystem.java:955) ~[jdk.zipfs:?] {}
		at jdk.nio.zipfs.ZipFileSystem$EntryInputStream.initDataPos(ZipFileSystem.java:1626) ~[jdk.zipfs:?] {}
		at jdk.nio.zipfs.ZipFileSystem$EntryInputStream.read(ZipFileSystem.java:1560) ~[jdk.zipfs:?] {}
		at jdk.nio.zipfs.ZipFileSystem$5.fill(ZipFileSystem.java:1505) ~[jdk.zipfs:?] {}
		at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:159) ~[?:?] {}
		at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:252) ~[modlauncher-8.0.9.jar:?] {}
		... 41 more

There's no reason this should happen. Guess I'll go ask the Forge people, but I don't think this is a bug in either that or CC.

commented

is there something i can do like updating forge or giving you more crash logs or do you have it from here?

commented

would you like to have all my full logs from today? or only some? as im not really sure which to send

commented

tryed rolling back to 1.98 to proleams were alittle less happen but moniters started going crazy with what size they where

commented

Had a chat with the people on the Forge discord (were very useful, โ™ฅ๏ธ), and general conclusion is that this really shouldn't be possible - something forcibly closed the file handle to the jar.

That said, someone else had this issue a while back https://pastebin.com/UjfxjiMh so it's clearly not unheard of. This occurred due to calling one thread interrupt ing another - though neither were the thread the exception was thrown on. More bizarrely, this happened every time - I'm kinda expecting weird conflict where a thread is interrupted while in the class loader - this seems too timing dependent to be deterministic.


@Ai-Kiwi It might be useful to have the full server logs as well, just in case there's something obvious going on just before a crash.

commented

2021-12-04-4.log.zip
here's all my crash's from today (recent ones are because I've tried rolling back through all versions to 1.98 and problem doesn't go away)

commented

ah also would pay to say in the logs if they stop in the middle of it loading its because some of the times I've force closed it for reasons.

commented

can confirm it is not another mod or the forge version as both of those things have not fixed the problem.

commented

Alright so abit of a update but ive fixed this proleam by removing the computer craft folder

commented

Ok so I have determined that the proleam is something todo with something happening while the server is starting I'm not sure what command makes it happen but I shell do some research when I get home. I have managed to fix the proleam by having a delay in startup.lua but again I shell do tests when I get home if I remember.

Edit: this is all me assuming I'm not fully sure about anything but delay did fix proleam.

Edit2: proleam maybe because I have computers chunkloaded with ftb chunks. So maybe it starts before world has fully booted or something?

commented

I've had the same or similar issue twice now on my server. Very strange occurrences. The first one seems to be caused by a disk reader, and only happened when the computer was turned on and the player teleported away, then returned. When the player returned to the chunks, the server immediately crashed with java.lang.NoClassDefFoundError: dan200/computercraft/shared/peripheral/diskdrive/DiskDrivePeripheral, and Caused by: java.nio.channels.ClosedChannelException
https://pastebin.com/88u6CH7k

The second one is almost stranger... It seems to be caused by the startup problem others are mentioning - the startup script immediately tries pull down scripts via wget. Please note that this only crashes the server after a sever restart; rebooting the computer after putting the startup script on it does not crash the server. However, once the server is restarted (or maybe the chunks are unloaded?) and the computer is loaded again, the crash occurs. This happens consistently, it isn't random.

The weird part is the ticking tile entity isn't even a computer! Seems like it's crashing when a Create mechanical crafter is looking through the CC disk recipes? Just plain weird, and almost weirder that removing the aforementioned startup script seemed to fix the crash.
https://pastebin.com/euEZUEYZ

commented

Sounds very much like the issue I ran into: McModLauncher/securejarhandler#37

commented

as @Drazuam said, editing a turtle's startup file to be shell.run("wget run https://example.com/cc/shop.lua") breaks the server on reboot, but works normally otherwise. Really cool stuff ๐Ÿ‘

commented

adding a sleep(0.1) before the shell.run("wget run xyz") seems to have fixed the server crash problem...

commented

This has been fixed in Forge 1.20.