Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerLifecycleEvents not triggered for datagen #1145

Closed
solonovamax opened this issue Jul 15, 2024 · 4 comments
Closed

ServerLifecycleEvents not triggered for datagen #1145

solonovamax opened this issue Jul 15, 2024 · 4 comments

Comments

@solonovamax
Copy link
Contributor

When using datagen in a dev env, ServerLifecycleEvents are not triggered.

This can cause issues with mods/apis that, for example, rely on ServerLifecycleEvents.SERVER_STOPPING to clean up some resources.

As an example, I ran into this issue with AzureDoom/AzureLib#62, where a thread executor is spawned in non-daemon mode, and will be closed down when the ServerLifecycleEvents.SERVER_STOPPING event is emitted.
However, since it is never emitted, this causes the datagen to never exit, as the jvm sees that there's an active thread that is not marked as a daemon thread.

Should ServerLifecycleEvents.SERVER_STOPPING be emitted when the datagen finishes, or should it be added to the docs to not use it for cleaning up resources, as it can fail during datagen?

@apple502j
Copy link

I believe SERVER_STOPPING should always be used in conjunction with SERVER_STARTING. And in any case, this is not a Loom issue.

@modmuss50
Copy link
Member

Neither of these should be fired during data generation. If the starting one is then it's a bug. (Report it to FabricAPI) I would almost always create your threads as daemons, Minecraft doesn't really have much of a concept of shutting down beyond saving the world. The essayist way to clean everything up is to close the entire process.

@modmuss50 modmuss50 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 16, 2024
@solonovamax
Copy link
Contributor Author

wait I just realized I opened this on the wrong repo lmao 💀

@solonovamax
Copy link
Contributor Author

I moved the issue over to the fabric api repo, and also updated it to indicate that a documentation change is desired, rather than a code change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants