fix(mcp): Resolve add_node resource leak and duplication issues#19
Open
alienfrenZyNo1 wants to merge 21 commits intoCoding-Solo:mainfrom
Open
fix(mcp): Resolve add_node resource leak and duplication issues#19alienfrenZyNo1 wants to merge 21 commits intoCoding-Solo:mainfrom
alienfrenZyNo1 wants to merge 21 commits intoCoding-Solo:mainfrom
Conversation
…ion-docs Add cursor integration docs
…cript-approach Feature/bundled gdscript approach
…id-support Changed Godot tooling to make use of Godot 4 API Added Debug mode, which adds additional tests and logging to Godot tools Added tools related to 4.4's uid files for scripts and resources other fixes and changes
…nfo-tool branches
…hing Implement robust pathing with improved validation
Parameter mapping
…parameter-mapping
improves parameter mapping
Modified godot_operations.gd to add a delay before freeing the instantiated scene root, preventing both RID leaks and node duplication.
- Make JSON param optional in godot_operations.gd _init - Add explicit param validation in GDScript functions - Add delay before quit() in GDScript for potential buffer flush - Infer resave_resources success via exit code & stderr in index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
add_nodeResource Leak and Duplication IssuesThis PR addresses issues encountered when using the
add_nodeMCP tool, which relies on thegodot_operations.gdscript running in headless mode.Problem:
RID allocations of type 'PN13RendererDummy14TextureStorage12DummyTextureE' were leaked at exiterrors, likely due to the instantiated scene root not being freed.scene_root.free()) resulted in duplicate nodes being added to the saved scene file. This might be due to freeing the node before theResourceSaver.save()operation fully completed in the headless environment.PackedSceneresource caused "Can't free a RefCounted object" errors.Solution:
add_nodefunction insrc/scripts/godot_operations.gdhas been modified:scene_root.free()call is reinstated to prevent the RID leak.OS.delay_msec(100)) is introduced afterResourceSaver.save()and beforescene_root.free(). This allows the save operation sufficient time to complete before the instantiated scene is freed, preventing the node duplication issue.PackedScenewas removed earlier in the debugging process.Verification:
add_nodetool after these changes..tscn) that the node is added correctly without duplicates.