[Bug] Server crash due to affinity data sync: "Unexpected request for task finish, current task: null"
chad-lagos opened this issue · 2 comments
Description
When running Primal Magick v6.0.7 on Minecraft 1.21.1 using Forge 52.1.1, the server disconnects clients with the following error:
yamlCopyEditInternal Exception: java.lang.IllegalStateException: Unexpected request for task finish, current task: null, requested: primalmagick:sync_affinity_data
This appears to occur during player login AFTER any user has logged into the server once. In other words, a user can log into the server and play normally. However, once they reconnect to the server a second time, the connection fails to the sync error.
Steps Taken and Troubleshooting Performed
-
Verified that both server and client use identical modpacks, including Primal Magick 6.0.7.
-
Verified that both server and client use Forge 52.1.1. Also tested Forge 52.1.0 with no improvement.
-
Cleared and regenerated all config files on both client and server.
-
Manually synced the
config/folders between client and server to ensure matching settings. -
Attempted to disable the affinity system, but no such option is available in the provided config files.
-
Confirmed the crash is not related to world generation, biomes, or datapacks.
Environment
Stack Trace (Excerpt)
yamlCopyEditInternal Exception: java.lang.IllegalStateException: Unexpected request for task finish, current task: null, requested: primalmagick:sync_affinity_data
Hypothesis
There may be a sync event for affinity data firing before the player or capability data is initialized on the server, leading to a null task reference. This may be a Forge compatibility issue or an internal timing issue within the mod’s sync logic.
Request
-
Can you confirm whether Primal Magick 6.0.7 is compatible with Forge 52.1.1 and Minecraft 1.21.1?
-
Is there a previous version of Primal Magick that is more stable for this Forge/Minecraft version combination?
-
Can you check for sync event errors in the code related to the affinity system and create a failsafe in case of a null task reference? One idea is to reset player affinity to a default value in case of a null task reference.
I'm happy to provide logs, test cases, or perform additional testing to help isolate the issue. Thank you for your time and for the work you've done on the mod! We love the lore and it has become a big part of the flavor of our world.
This is a very thorough bug report, thank you! To address your questions:
- I can confirm that PM 6.0.7 is supposed to be compatible with MC 1.21.1, but I haven't tested it with that Forge version. Development for this version of MC was mostly done against Forge 52.1.0, but I wouldn't expect a point release of Forge to make that much of a difference. Nothing in the changelog is jumping out at me, at least.
- In theory, any of the 6.x releases of Primal Magick should work with MC 1.21.1, but if memory serves, all of them use the same code for this particular initialization task. I'd be surprised if they worked better for you, but I've been wrong before.
- I'll see what I can do regarding an investigation of the initialization task code. The task that's failing is the one that sends affinity data for blocks/items from the server to your client, but there's a second one that also fires. There may be room to improve that part of the code, but it'll be difficult for me to test as this isn't a bug I've ever been able to reproduce in my test environment.
I tested a few more things to isolate the bug further:
- The affinity sync error is appearing on a new world, with only the primal magick mod (and its dependency) installed on my server.
- Locally hosted single player worlds work as expected.
I've attached the logs for the client and host, which are both showing this error.