Repository navigation
Unregistered Static Initializer causing wrong RPC registration - #493
Open
MidnightsFX wants to merge 2 commits into
Open
MidnightsFX wants to merge 2 commits into
MidnightsFX wants to merge 2 commits into
Conversation
Member
|
Should that not be mitigated by having a dependency on Jötunn? |
Contributor
Author
It should if load order is observed. The problem, is if any mod loads others, classic example being caching asset packages etc. It can cause this. I'm not saying this is absolutely required as a fix. But I noticed it after digging into a report and was trying to figure out how client vs server RPC registration did not match. It felt like something that would not be too hard to call out when it happens and would make diagnosing such issues considerably easier. |
Member
|
It does not really help that we have that static Localization in the mod stub I guess xD |
Contributor
Author
|
Yeah that probably doesn't help 😅 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into an odd situation, where if for any reason mod code is loaded before a plugin has been initialized, its plugin signature will be cached as Jotunn.
This results in RPC names that include Jotunn as the plugin name, instead of the mods plugin name.
For example, static initialization of the localization manager in the plugins body, outside of awake, can result in registering the plugins RPCs under Jotunn.
Anything that walks through other mods and touches the plugin will load the static, which causes this issue- if the plugin itself is not already registered.
The trivial solution is not to call any manager instance instantiation in statics outside of the plugins awake. However, since this issue is otherwise transparent- having certain mod combinations installed could result in different RPC names on a server vs client.