SpongeForge crashes in odd circumstances


I’ve been getting really odd reports of SpongeForge servers crashing when using a newer version of my plugin, but I have no idea what the exception means and how my plugin interacts with any of it.

Basically all of the crashes have this exception in common:

java.lang.NoClassDefFoundError: some class
Caused by: java.lang.ClassNotFoundException: some class
Caused by: java.lang.SecurityException: class "some class"'s signer information does not match signer information of other classes in the same package

My plugin doesn’t load any extra classes nor does any funky stuff with class loading.

Here are the crash pastes I have got from 4 different people:

I’ve found a temporary solution which stops the crashes, so it has to be in my code & I think it is related to this method because if the code is diverted away from this class, the crashes don’t happen.

What could it be?

How are you compiling your file? Via build artifact/export jar? Via Gradle? Via Maven?

I’m using Gradle with

  • dagger-compiler which processes some annotations during compilation to generate dependency injection stuff.
  • blossom for replacing version tags before compilation
  • shadow for including and relocating dependencies

I don’t think it is due to compilation, because a slightly older version works fine using the same tooling.

I noticed that the URLConnection was not disconnected in the method I linked. I am waiting for user feedback to confirm if that was the issue.

Edit: That was the issue - or at least delays it

I discovered the same issue a month ago. A created a minimal reproducible example here GitHub - Yeregorix/ClassloaderBreaker: A plugin example which break Forge classes by just calling setDefaultUseCaches.. I don’t know why but calling setDefaultUseCaches causes Forge to crash. So just don’t call it.

1 Like

I honestly totally forgot about this issue, and meant to take a look into it further. I’ll update the thread if I find the cause*

Edit: lol I might actually know the reason - but will confirm later

1 Like

Out of curiosity, does it crash if you use setUseCaches instead of setDefaultUseCaches?

Nop, it doesn’t crash.

So I think, But have not fully confirmed:
When you set the default caches, You might also be setting cache settings for like JarUrlConnections… Which might be causing strange issues.

1 Like