SendCustomNetworkEvent Stops Working
needs more information
Quap
Under certain conditions that I can't reproduce reliably, all network events stop working for a player. It looks like it always happens when the owner/master changes.
This causes big issues in high frequented instances where the master changes a lot.
World where it happens to me: https://vrchat.com/home/world/wrld_3fb6208d-54d7-4a9f-9cf9-11341fa36037
All objects are active and never get deactivated. Serialization and Deserialization works fine for all players. The network is not clogged and is happy.
The network events stop working completely for the client that experiences this behavior regardless of the target (All, Owner) and they don't send or receive any events anymore. The behavior never recovers.
If another client tries to send a network event directly to that player (owner) the event gets blocked.
I verified that the code works by executing the methods on the client with the bug by hand. (Thanks BobyStar)
The code sends maybe 3 events in 20 seconds on multiple UdonSharpBehaviours.
I attached some code examples that don't get executed from the network event, but if I execute them by hand it works.
The error that's after the rpc call was captured on a non-owner client that tried to send a network event to the owner who was experiencing the behavior described above. This was after I pressed a button that executes the "StartLobby" method.
In the code example with the Debug logs I see the first log "All players finished race!" but I don't see the "OnGame Done!" on any client.
Log In
Fax
needs more information
Hi Quap! Thanks for reporting the issue.
Without a reliable reproduction, it's difficult for us to help with the issue. Do you know under which conditions this issue is most likely to happen?
Networked events can sometimes be unreliable - if you want to work around the issue, you could consider using synced variables instead.
Quap
Hey Fax ! It seems like the bug happens when the master changes. I recorded a video to show what happens, maybe it could help find the bug? Sorry I can't provide better reproduction steps.
In the video, the right client is the master and owner of the lobby.
The start button executes the "StartLobby" method from the picture above.
You can see that pressing the button on the non-owner client calls the network event, but the owner never receives or execute it. When I press the button as the owner, the lobby starts as intended and tries to start a game. So the serialization and deserialization work fine.
The documentation states that the network events are guaranteed to arrive but even if they aren't, in my case the network events stop working completely and never get back to working.
I've worked around it for the most critical things, but I like the simplicity of network events for things that don't need to be synced to late joiners like a button press.
_
_tau_
Quap: According to the log screenshot you posted this seems like an ownership disagreement has occured. The line states that "Mabel" has received an event that was destined for the owner, but they aren't the owner of that object at the time of receival (non-owner).
Do you have conflicting ownership transfer logic that could run while the network event is in flight? Note that ownership events are faster than event calls and could "overtake" an in-flight request.
As a further debugging step, could you add some logs or an in-world readout of the current ownership state of the involved objects? Switching master may be a scenario that can trigger ownership issues, if that is the case having a reproduction method for that part of the bug would be super helpful (even if it's just some logs in a world we can load up for testing).
Quap
Hey _tau_ !
The owner is only changing when the master changes.
I added a way to see the owner of the game lobby.
It looks like both clients think the same player is the owner. In the video at around the 2 minute mark, you can see that the master owns all objects as expected, and both clients show them as the owner. The images below show the same with the in-world owner output.
I can definitely say that the bug happens as soon as the master changes and all the ownership of the objects get transferred to a new user. I still can't reproduce it reliable, but I opened 3 clients and rejoined with them, letting the master change a few times, and then it sometimes happen. But sadly I can't give any more information about what exactly triggers it at the moment.