godotengine / godotengine/godot
Peer Disconnect Reconnect Replication Issue
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible 4.2.1, 4.3-dev4
### System information
Ubuntu 22.04 - Godot 4.2.1
### Issue description
If a MultiplayerSynchronizer's SceneReplicationConfig is modified via script and client disconnects and reconnects. Previous multiplayer unique id replication is still cached and throughs errors. Newly connected Clients are no longer replicated.
If replication_config is not touched with script there is no issue.
### Steps to reproduce
Peer Connects
Create "player" with MultiplayerSynchronizer
- add new property to replication_config
Disconnect player
Reconnect player
### Minimal reproduction project (MRP)
[client_reconnect_issue.zip](https://github.com/godotengine/godot/files/14476194/client_reconnect_issue.zip)
Project has interface to reproduce issue.
Read short instructions watch output.
Example output
```
Server started putting api on node /root/main/Server
Client started putting api on node /root/main/Client
Client : peer connected 1
Server : peer connected 2076042518
Client: _exit_tree()
Server : peer disconnected 2076042518
2076042518: removing peer
Client started putting api on node /root/main/Client
Client : peer connected 1
Server : peer connected 601296107
E 0:00:09:0138 multiplayer_api.gd:42 @ _on_peer_connected(): Node '/root/main/Server/2076042518:dynamic_sync' not found.
Condition "!node || !node->has_node(p_path)" is true. Returning: nullptr
modules/multiplayer/multiplayer_synchronizer.cpp:41 @ _get_prop_target()
multiplayer_api.gd:42 @ _on_peer_connected()
E 0:00:09:0138 multiplayer_api.gd:42 @ _on_peer_connected(): Parameter "obj" is null.
modules/multiplayer/multiplayer_synchronizer.cpp:164 @ get_state()
multiplayer_api.gd:42 @ _on_peer_connected()
E 0:00:09:0138 multiplayer_api.gd:42 @ _on_peer_connected(): Unable to retrieve spawn state.
Condition "err != OK" is true. Returning: err
modules/multiplayer/scene_replication_interface.cpp:516 @ _make_spawn_packet()
multiplayer_api.gd:42 @ _on_peer_connected()
E 0:00:09:0138 multiplayer_api.gd:42 @ _on_peer_connected(): Condition "!p_buffer || p_size < 1" is true. Returning: ERR_INVALID_PARAMETER
modules/multiplayer/scene_replication_interface.cpp:462 @ _send_raw()
multiplayer_api.gd:42 @ _on_peer_connected()
endless repeat of errors...
E 0:00:11:0154 _get_prop_target: Node '/root/main/Server/2076042518:dynamic_sync' not found.
Condition "!node || !node->has_node(p_path)" is true. Returning: nullptr
modules/multiplayer/multiplayer_synchronizer.cpp:41 @ _get_prop_target()
E 0:00:11:0154 _watch_changes: Node not found for property '/root/main/Server/2076042518:dynamic_sync'.
Condition "!obj" is true. Continuing.
modules/multiplayer/multiplayer_synchronizer.cpp:389 @ _watch_changes()
```
Contributor guide
Assessment
This issue has not been assessed yet.