godotengine / godotengine/godot
[3.x] Endless importing with indefinitely increasing memory usage
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in 3.5.3
- Reproducible in 3.6
### System information
Windows 11 - Godot 3.6 stable - Nvidia GTX 1650, Intel i5 9300H, 8GB of RAM
### Issue description
This started with me playing the [Index Purger Demo](https://store.steampowered.com/app/2989940/Index_Purger_Demo_v10/), noticing performance issues with it with NPCs and other things.
The developer provided me with the source code of the game, so that I can use Godot's profiler to perform my own performance testing of the game, as the demo available on Steam does not have a profiler built in. The source code did not have a `.import` folder as it was ignored by .gitignore and etc.
When I launched the project in Godot, it seemed to be importing normally. I left it running and returned to see it crashed. Curious, I opened it and set the process priority of Godot to `High` and watched it in task manager. The RAM usage slowly increase until it crashed.
Since my laptop normally runs at 50% idle ram usage, I closed and shut down every app and background task I could get away with closing until my ram usage was at 39% idling (around 4.6gb free), then launched Godot. Godot started normally, then suddenly [the console was flooded with import errors](https://github.com/user-attachments/assets/4940bcef-10c6-471e-9caf-1890d07b358e), and attempted to reimport said files. The ram usage spiked to 2GB of ram usage, then 4GB, then 5GB, where it then fluctuated between 3-4GB until it crashed. When it crashed, it could have gone on for longer. There was more than enough ram left for it to use, yet it still crashed.
I repeated this procedure multiple times, even deleting the `.import` folder entirely. All resulted in the same outcome.
[This](https://youtu.be/BvGKxKG8DYc) is a video (sped up by 4 times) showcasing the entire scenario unfolding. Please watch it to get a full visualization of the issue.
This issue occurs on `Normal`, `High` and `Realtime` process priority in task manager, and occurs on both 3.5.3 and 3.6. It occurs on HDD and SSD.
Setting the priority to `Realtime` just makes it die faster.
### Steps to reproduce
1. Launch the Index Purger SDK from Steam, or manually open it in Godot 3.6.
2. Wait and monitor through task manager.
3. You will observe that the ram increases until it eventually crashes.
### Minimal reproduction project (MRP)
The Index Purger SDK.
I'm not sure what more to do in regards to this. Dadaskis will have more in this aspect.
Contributor guide
Research direction
Start by reproducing the import process with the Index Purger SDK in Godot 3.6 on Windows, while monitoring memory usage and the import errors in the console. Compare behavior after deleting the .import folder and across the reported process priorities; done means identifying the import failure causing unbounded memory growth and preventing the crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, godot
- Domain
- game-dev, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100