Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDScript leaking potentially when cannot load due to cyclic dependency #32378

Closed
hbina opened this issue Sep 26, 2019 · 3 comments
Closed

GDScript leaking potentially when cannot load due to cyclic dependency #32378

hbina opened this issue Sep 26, 2019 · 3 comments

Comments

@hbina
Copy link
Contributor

hbina commented Sep 26, 2019

Godot version:
b2569d5

OS/device including version:
Linux Ubuntu 5.3.1-050301-generic

Issue description:
Godot is leaking memory (failure to cleanup).
It possibly happen when GDScript fails to load a class due to cyclic dependency or parse error.

SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Game.gd:82.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Networking/Network.gd:235.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Game.gd:82.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
ERROR: start: Timer was not added to the SceneTree!
   At: scene/main/timer.cpp:111.
ERROR: start: Timer was not added to the SceneTree!
   At: scene/main/timer.cpp:111.
SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Networking/Network.gd:236.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
ERROR: ~List: Condition ' _first != __null ' is true.
   At: ./core/self_list.h:111.
ERROR: ~List: Condition ' _first != __null ' is true.
   At: ./core/self_list.h:111.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:2069.
ERROR: clear: Resources Still in use at Exit!
   At: core/resource.cpp:443.

Steps to reproduce:

  1. Clone KoBeWi's https://github.com/KoBeWi/The-Soulhunter
  2. Run the game at least once (there will be errors)
  3. Exit

Minimal reproduction project:
https://github.com/KoBeWi/The-Soulhunter

@hbina
Copy link
Contributor Author

hbina commented Sep 26, 2019

Update: It will leak simply by opening and closing the project...Will try to investigate...

Godot Engine v3.2.alpha.custom_build.edf9055b7 - https://godotengine.org
XInput: Refreshing devices.
XInput: No touch devices found.
Detecting GPUs, set DRI_PRIME in the environment to override GPU detection logic.
Only one GPU found, using default.
Failed loading custom cursor: size_bdiag
Failed loading custom cursor: size_fdiag
Using GLES3 video driver
OpenGL ES 3.0 Renderer: AMD RAVEN (DRM 3.33.0, 5.3.1-050301-generic, LLVM 8.0.0)
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms
 
CORE API HASH: 5805935394354442454
EDITOR API HASH: 7604539241462553616
Construct gdnative interface

Destruct gdnative interface

Loading resource: /home/hbina085/.config/godot/editor_settings-3.tres
EditorSettings: Load OK!
Loading resource: res://Scripts/Networking/Network.gd
Loading resource: res://Nodes/Player.tscn
Loading resource: res://Scripts/Player.gd
Loading resource: res://Nodes/Projectiles/PBat.tscn
Loading resource: res://Graphics/Enemies/Bat.png
Loading resource: res://Audio/Bat.wav
Loading resource: res://Scripts/PlayerProjectile.gd
Loading resource: res://Scripts/Networking/Data.gd
Loading resource: res://Nodes/Projectiles/PEcho.tscn
Loading resource: res://Graphics/Projectiles/Echo.png
Loading resource: res://Nodes/Projectiles/PBone.tscn
Loading resource: res://Graphics/Projectiles/Bone.png
Loading resource: res://Audio/Throw.wav
Loading resource: res://Nodes/Projectiles/PDagger.tscn
Loading resource: res://Graphics/Projectiles/Dagger.png
Loading resource: res://Nodes/Projectiles/PSkeleton.tscn
Loading resource: res://Graphics/Projectiles/SummonSkeleton.png
Loading resource: res://Audio/Skeleton.wav
Loading resource: res://Nodes/PlayerCamera.tscn
Loading resource: res://Nodes/UI/UIMain.tscn
Loading resource: res://Scripts/UI/UI.gd
Loading resource: res://Scripts/System/Controls.gd
Loading resource: res://Scripts/Networking/Packet.gd
Loading resource: res://Nodes/UI/HUD.tscn
Loading resource: res://Resources/UI/Standard.tres
Loading resource: res://Resources/UI/DefaultFont.tres
Loading resource: res://Resources/UI/DejaVuSerif.ttf
Loading resource: res://Graphics/UI/StatusBars.png
Loading resource: res://Graphics/UI/Exp Bar.png
Loading resource: res://Graphics/UI/HealthBar.png
Loading resource: res://Graphics/UI/ManaBar.png
Loading resource: res://Nodes/UI/PlayerMenu.tscn
Loading resource: res://Scripts/UI/PlayerMenu/PlayerMenu.gd
Loading resource: res://Scripts/UI/PlayerMenu/Stats.gd
Loading resource: res://Scripts/UI/PlayerMenu/Inventory.gd
Loading resource: res://Nodes/UI/InventorySlot.tscn
Loading resource: res://Graphics/UI/InventorySpace.png
Loading resource: res://Graphics/UI/InventorySelect.png
Loading resource: res://Resources/UI/SmallFont.tres
Loading resource: res://Graphics/UI/DescriptionPanel.png
Loading resource: res://Graphics/Items/0.png
Loading resource: res://Scripts/UI/PlayerMenu/Equipment.gd
Loading resource: res://Nodes/UI/EquipmentSlot.tscn
Loading resource: res://Graphics/UI/EquipmentSlot.png
Loading resource: res://Scripts/UI/PlayerMenu/Souls.gd
Loading resource: res://Scripts/Soul.gd
Loading resource: res://Graphics/Objects/Soul.png
Loading resource: res://Nodes/UI/SoulSlot.tscn
Loading resource: res://Scripts/UI/SoulSlot.gd
Loading resource: res://Graphics/UI/SoulSlot.png
Loading resource: res://Nodes/UI/SoulItem.tscn
Loading resource: res://Graphics/UI/OnOff.png
Loading resource: res://Graphics/UI/SoulSelect.png
Loading resource: res://Nodes/UI/Key.tscn
Loading resource: res://Graphics/UI/Keys/Normal.png
Loading resource: res://Resources/UI/BiggerFont.tres
Loading resource: res://Graphics/UI/Keys/Wide.png
Loading resource: res://Graphics/UI/Keys/Tall.png
Loading resource: res://Graphics/UI/Keys/Enter.png
Loading resource: res://Scripts/KeySuperlist.gd
Loading resource: res://Nodes/Map.tscn
Loading resource: res://Scripts/UI/MapMenu.gd
Loading resource: res://Graphics/Map/Position.png
Loading resource: res://Nodes/UI/Chat.tscn
Loading resource: res://Scripts/UI/Chat.gd
Loading resource: res://Resources/UI/BoldFont.tres
Loading resource: res://Nodes/UI/Labels.tscn
Loading resource: res://Scripts/UI/LabelManager.gd
Loading resource: res://Nodes/UI/InfoLabel.tscn
Loading resource: res://Audio/Item.wav
Loading resource: res://Audio/Soul.wav
Loading resource: res://Nodes/Weapons/Fist.tscn
Loading resource: res://Scripts/Weapon.gd
Loading resource: res://Audio/Fist.wav
Loading resource: res://Nodes/Effects/PopupText.tscn
Loading resource: res://Scripts/Resources/Character.gd
Loading resource: res://Graphics/Characters/Player.png
Loading resource: res://Graphics/Characters/PlayerColor.png
Loading resource: res://Graphics/Enemies/Skeleton.png
Loading resource: res://Graphics/UI/PressUp.png
Loading resource: res://Audio/Jump.wav
Loading resource: res://Audio/Jump2.wav
Loading resource: res://Audio/Land.wav
Loading resource: res://Audio/Save.wav
Loading resource: res://Scenes/InGame.tscn
Loading resource: res://Scripts/Game.gd
Loading resource: res://Scenes/GameOver.tscn
Loading resource: res://Graphics/UI/Title.png
Loading resource: res://Resources/UI/EvenBiggerFont.tres
Loading resource: res://Scripts/Networking/Unpacker.gd
Loading resource: res://Scripts/System/Resources.gd
Loading resource: res://Nodes/System/Commons.tscn
Loading resource: res://Scripts/System/Commons.gd
Loaded builtin certs
EditorSettings: Save OK!
Loading resource: res://Scenes/Title.tscn
Loading resource: res://Graphics/UI/TitleText.png
�[1;31mERROR: start: �[0m�[1mTimer was not added to the SceneTree!
�[0;31m   At: scene/main/timer.cpp:111.�[0m
�[1;31mERROR: start: �[0m�[1mTimer was not added to the SceneTree!
�[0;31m   At: scene/main/timer.cpp:111.�[0m
EditorSettings: Save OK!
�[1;31mERROR: ~List: �[0m�[1mCondition ' _first != __null ' is true.
�[0;31m   At: ./core/self_list.h:112.�[0m
�[1;31mERROR: ~List: �[0m�[1mCondition ' _first != __null ' is true.
�[0;31m   At: ./core/self_list.h:112.�[0m
�[1;33mWARNING: cleanup: �[0m�[1mObjectDB Instances still exist!
�[0;33m   At: core/object.cpp:2069.�[0m
Leaked instance: GDScript:5500 - Resource name:  Path: res://Scripts/Networking/Packet.gd
Leaked instance: GDScriptNativeClass:561
�[1;31mERROR: clear: �[0m�[1mResources Still in use at Exit!
�[0;31m   At: core/resource.cpp:443.�[0m
Orphan StringName: res://Scripts/Networking/Packet.gd::44::Packet.add_string
Orphan StringName: stat_list
Orphan StringName: data
Orphan StringName: Reference
Orphan StringName: add_u16
Orphan StringName: GDScriptNativeClass
Orphan StringName: TYPE
Orphan StringName: add_u8
Orphan StringName: res://Scripts/Networking/Packet.gd::61::Packet.add_u16
Orphan StringName: i
Orphan StringName: res://Scripts/Networking/Packet.gd::67::Packet.send
Orphan StringName: to_ascii
Orphan StringName: add_string_unicode
Orphan StringName: append
Orphan StringName: command
Orphan StringName: res://Scripts/Networking/Packet.gd
Orphan StringName: Network
Orphan StringName: length
Orphan StringName: send
Orphan StringName: append_array
Orphan StringName: to_utf8
Orphan StringName: _init
Orphan StringName: res://Scripts/Networking/Packet.gd::50::Packet.add_string_unicode
Orphan StringName: send_data
Orphan StringName: res://Scripts/Networking/Packet.gd::39::Packet._init
Orphan StringName: GDScript
Orphan StringName: add_string
Orphan StringName: res://Scripts/Networking/Packet.gd::56::Packet.add_u8
Orphan StringName: string
StringName: 29 unclaimed string names at exit.

@clayjohn
Copy link
Member

Can you still reproduce this bug in Godot 3.2.2 or any later release?

This may also be something that isn't being fixed until Godot 4.0 releases with the new improvements to GDScript. I remember vnen talking about improvements to cyclic dependencies.

@akien-mga
Copy link
Member

akien-mga commented Feb 3, 2021

Duplicate of #21461.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants