MultiplayerENet w/ RPC in Linux Server runtime

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By I.A

I’ve built a simple godot server running on MultiplayerENet using RPC for client-server communication. My client-and server are separate projects. I’ve exported my server to a Linux .pck file and I use the Linux server runtime from the Godot site to run the server but I get the following errors when connecting with my client:

ERROR: _process_get_node: Condition "!F" is true. Returned: __null
   At: core/io/multiplayer_api.cpp:265.
ERROR: _process_packet: Condition "node == __null" is true.
   At: core/io/multiplayer_api.cpp:204.
ERROR: _process_get_node: Condition "!F" is true. Returned: __null
   At: core/io/multiplayer_api.cpp:265.
ERROR: _process_packet: Condition "node == __null" is true.
   At: core/io/multiplayer_api.cpp:204.
ERROR: _process_get_node: Condition "!F" is true. Returned: __null
   At: core/io/multiplayer_api.cpp:265.
ERROR: _process_packet: Condition "node == __null" is true.
   At: core/io/multiplayer_api.cpp:204.

This does not happen when I run the client-and server in-editor. does anyone have any clue what could the be underlying issue here? I looked up the source code for line 265 which is:

ERR_FAIL_COND_V_MSG(!F, NULL, "Invalid packet received. Unabled to find requested cached node.");

And line 204:

ERR_FAIL_COND_MSG(node == NULL, "Invalid packet received. Requested node was not found.");

My networking code runs inside of a plugin that I built myself. This includes the RPC calls.

This problem only occurs when I use the Linux Server runtime downloaded from Redirecting…. it works fine if i use the normal runtime. However, I intend to containerize my server applications so I can’t rely on the normal runtime. I need the server runtime that doesn’t include all the graphics and audio.

I’ve built my application with Godot 3.2.

Update: Hereby I am including sample code to reproduce the problem:

Server:

extends Node

func _ready():
	var peer = NetworkedMultiplayerENet.new()
	peer.create_server(43594, 16)
	get_tree().set_network_peer(peer)
	
remote func hello_world():
	print("Hello World!")
	rpc_id(get_tree().get_rpc_sender_id(), "reply")

Client:

extends Node

func _ready():
	get_tree().connect("connected_to_server", self, "_connected_to_host_ok")
	get_tree().connect("connection_failed", self, "_failed_to_connect_to_host")
	
	var peer = NetworkedMultiplayerENet.new()
	peer.create_client("localhost", 43594)
	get_tree().set_network_peer(peer)
	
func _connected_to_host_ok():
	print("Telling server to print Hello World!")
	rpc_id(1, "hello_world")

remote func reply():
	print("Received a reply from the server to also print Hello World!")

Export the server project to a .pck file, rename it to be the same as the Linux server runtime file and run it in CLI as for example: ./sample-server.64

:bust_in_silhouette: Reply From: tx350z
ERR_FAIL_COND_MSG(node == NULL, "Invalid packet received. Requested node was not found.");

The most common cause of this error is a Node path or name mismatch between the client and server. I suggest you manually set the Node name (I generally do this in _init()). For example, place in both the server and client.

func _init():
	self.name = "mysvr";

Also keep in mind that the Node path to the rpc objects must be EXACTLY the same in both the server and client. The easiest solution is to make the objects children of the root node.

get_tree().root.add_child(mysvr);

This also assures they will be cleaned up when the app exits so you won’t have to chase memory leaks.