Skip to content

Platform Buddies! v0.0.5

Compare
Choose a tag to compare
@ETdoFresh ETdoFresh released this 23 Aug 21:04
· 4 commits to master since this release

HTML5

http://www.etdofresh.com/PlatformBuddies/v0.0.5/

Response to Issue

Woot! So good news! I replicated the problem! The culprit (in my case) was a script I downloaded to show "stats". There is a call to "weakref" and "call" during the connection process which I think causes the websocket server to crash [more info below].

TLDR: Looks like a questionable script that spits out stats caused errors during the WebSocket connection process.

Here's the server log:

C:\Users\etgarcia\Desktop\PlatformBuddies>docker run -itp 11003:11003 etdofresh/platform_buddies
GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/godot-server...
(No debugging symbols found in /usr/local/bin/godot-server)
Starting program: /usr/local/bin/godot-server --path /app
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7f14ca360700 (LWP 12)]
Godot Engine v3.2.2.stable.official - https://godotengine.org
[New Thread 0x7f14ca105700 (LWP 13)]
[New Thread 0x7f14ca0c4700 (LWP 14)]

Platform Buddies! v0.0.5
0
0
0
A Client has connected! 172.17.0.1:53360
A Client has disconnected! 172.17.0.1:53360
A Client has connected! 172.17.0.1:53366
A Client has connected! 172.17.0.1:53372
A Client has connected! 172.17.0.1:53378
...various more like this...
A Client has connected! 172.17.0.1:53450 <<< CRASH!!!
--Type <RET> for more, q to quit, c to continue without paging--

Thread 1 "godot-server" received signal SIGSEGV, Segmentation fault.
0x00000000008e36e0 in Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) ()
(gdb) bt
#0  0x00000000008e36e0 in Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) ()
#1  0x000000000184e5d7 in GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*) ()
#2  0x0000000001851112 in GDScriptInstance::call_multilevel(StringName const&, Variant const**, int) ()
#3  0x0000000000000000 in ?? ()

I have committed the bad code into this repository (v0.0.5):
http://www.etdofresh.com/PlatformBuddies

Here is the psuedo "trace" of the problem:

var server = WebSocketServer.new()
server.connect("client_connected", self, "create_player")
func create_player(id, _protocol):
    var client = server.get_peer(id)
    var input = NETWORK_INPUT.instance()
    add_child(input)
    var character = spawn_random_character(input)
    ## ERROR LINE BELOW: ------
    $CanvasLayer/ServerStats.add_stat("X", input, "x", false)
extends Panel

var stats = []

func add_stat(stat_name, object, stat_reference, is_method):
    stats.append([stat_name, object, stat_reference, is_method])

func _process(_delta):
    var label_text = ""
    for stat in stats:
        var value = null
        if stat[1] and weakref(stat[1]).get_ref(): # MY GUESS IS THIS
            if stat[3]:
                value = stat[1].call(stat[2]) # OR THIS THAT IS CAUSING THE ISSUE
            else:
                value = stat[1].get(stat[2])
        label_text += str(stat[0], ": ", value)
        label_text += "\n"
    $VBoxContainer/Value.text = label_text