godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.04k stars 20.19k forks source link

N18RendererCanvasCull4ItemE memory leak at exit #84411

Open tlloancy opened 10 months ago

tlloancy commented 10 months ago

Godot version

4.1.3

System information

Windows 10

Issue description

ERROR: 1 RID allocations of type 'N18RendererCanvasCull4ItemE' were leaked at exit.
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object/object.cpp:2047)
Leaked instance: GDScriptNativeClass:-9223014145819934213
Leaked instance: GDScript:-9222511119250226071 - Resource path: res://Client/Client.gd
Leaked instance: Object:914793674310766
Leaked instance: Control:914243918496880 - Node name:
Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`).
ERROR: Resources still in use at exit (run with --verbose for details).
   at: clear (core/io/resource.cpp:489)
Resource still in use: res://Client/Client.gd (GDScript)

Steps to reproduce

App launched with --verbose option and quitted

tryed to add queue_free() in

func _exit_tree() -> void:
    thread.wait_to_finish()

heres what th ready function looks like as i first incriminated the thread:

func _ready():
    thread = Thread.new()
    thread.start(self._on_message.bind(null))

    get_viewport().files_dropped.connect(Callable(self, "_on_files_dropped"))
    _relay_client = $WebsocketClient
    _relay_client.connect("on_message", Callable(self, "_on_message"))
    _relay_client.connect("on_players_ready", Callable(self, "_on_players_ready"))

    $StartScreen/StartGameButton.connect("pressed", Callable(self, "_on_start_game"))

    $StartScreen.show()
    $Lobby.hide()

and here's the _on_message one

func _on_message(message : Message):
    if (!message) : return
    if (message and message.disconnected_closed): return
    if (message and message.disconnected_disconnected): return
    if (message and message.server_login): return
    if (message and message.match_start): return
    else:
        if (message.content.has("seed")):
            process_message(message)

        if (message.content.has("whoiam")):
            process_whoiam_message(message)

Minimal reproduction project

N/A

AThousandShips commented 10 months ago

Please provide more details about your setup then just the operating system

tlloancy commented 10 months ago

Please provide more details about your setup then just the operating system Nom de l'appareil LAPTOP-5Q7RHMNT Processeur Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz 2.59 GHz Mémoire RAM installée 16,0 Go (15,8 Go utilisable) ID de périphérique 98AD7A8E-6E7B-4F1B-BC4C-C543871D905F ID de produit 00325-81805-44683-AAOEM Type du système Système d’exploitation 64 bits, processeur x64 Stylet et fonction tactile La fonctionnalité d’entrée tactile ou avec un stylet n’est pas disponible sur cet écran

Édition Windows 10 Famille Version 20H2 Installé le ‎12/‎11/‎2020 Version du système d’exploitation 19042.746 Expérience Windows Feature Experience Pack 120.2212.551.0

AThousandShips commented 10 months ago

Please provide the information in English, you can get this from the editor, see the instructions in the issue template

tlloancy commented 10 months ago

Processor Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz 2.59 GHz Installed RAM 16.0 GB (15.8 GB usable)

superherointj commented 10 months ago

From a new empty project (Godot 4.1.3) I'm being able to replicate error:

ERROR: 1 RID allocations of type 'N18RendererCanvasCull4ItemE' were leaked at exit. WARNING: ObjectDB instances leaked at exit (run with --verbose for details).

Tested in Linux NixOS. Command used to export:

godot4 --path . --headless --export-release "Linux/X11" $out/bin/empty

Godot Engine v4.1.3.stable.nixpkgs.fc7920185 - https://godotengine.org

WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:480)
Fontconfig error: Cannot load default config file: No such file: (null)
WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:73)
reimport: begin: (Re)Importing Assets steps: 1
        reimport: step 0: icon.svg
savepack: begin: Packing steps: 102
        savepack: step 2: Storing File: res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex
        savepack: step 2: Storing File: res://icon.svg.import
        savepack: step 52: Storing File: res://.godot/exported/133200997/export-3070c538c03ee49b7677ff960a3f5195-main.scn
        savepack: step 102: Storing File: res://main.tscn.remap
        savepack: step 102: Storing File: res://.godot/global_script_class_cache.cfg
        savepack: step 102: Storing File: res://icon.svg
        savepack: step 102: Storing File: res://.godot/uid_cache.bin
        savepack: step 102: Storing File: res://project.binary
savepack: end
reimport: end
ERROR: 1 RID allocations of type 'N18RendererCanvasCull4ItemE' were leaked at exit.
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object/object.cpp:2047)

Full empty project at: https://github.com/superherointj/godot-debug-N18RendererCanvasCull4ItemE

tlloancy commented 10 months ago

this is fixed on 4.2

akien-mga commented 10 months ago

I confirm that @superherointj's MRP reproduces the bug in 4.1.2, but it's fixed in 4.2-beta5.

superherointj commented 10 months ago

I confirm that @superherointj's MRP reproduces the bug in 4.1.2, but it's fixed in 4.2-beta5.

akien-mga, thanks for testing.

Just tried Godot 4.2-beta5, commit: 4c96e9676, but error persist. Logs: https://termbin.com/fh59 I have updated repository to version v4.2.rc2 (error persists).

Have you tested on Linux? [I'm trying to understand why it works for you but not for me.]

joined72 commented 9 months ago

I confirm the bug on 4.2 stable too! :( Please fix it asap.

AThousandShips commented 9 months ago

We are doing the best we can, but we have little details on what is causing this, please provide more details on what platform you are on

It's also not a serious bug, so less likely to get any major focus, no pressing need to "fix it asap", it'd be nice to fix it but without someone identifying what's causing it it's not as easy

joined72 commented 9 months ago

We are doing the best we can, but we have little details on what is causing this, please provide more details on what platform you are on

Download the following asset demo project, run it, eat an apple in the game and close it, you will see the error. asset demo project

It's also not a serious bug, so less likely to get any major focus, no pressing need to "fix it asap"

Yes I understand, excuse me please.

AThousandShips commented 9 months ago

No, what your platform and hardware details are 🙂 your operating system, processor, graphics, etc.

joined72 commented 9 months ago

No, what your platform and hardware details are 🙂 your operating system, processor, graphics, etc.

I'm working on Ubuntu 22.04, Nvidia GTX 2060, AMD Ryzen 5 2600X with 16Gb RAM and SDD NVME 512 Gb

PS: I'm using double monitor and XFCE 4.18 Desktop

tlloancy commented 9 months ago

No, what your platform and hardware details are 🙂 your operating system, processor, graphics, etc.

I'm working on Ubuntu 22.04, Nvidia GTX 2060, AMD Ryzen 5 2600X with 16Gb RAM and SDD NVME 512 Gb

PS: I'm using double monitor and XFCE 4.18 Desktop

Good choice if I may (except I'd have gone straight for debian 😀)