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
Multi-threading debugger errors when using large loops #32441
Comments
I tested 1 min but nothing shows, but maybe this is related: With compiled Godot with sanitizers support
when I run project and I pressed exit key on keyboard then Godot used freed memory:
|
I am experiencing a similar issue. I am not certain it is the same issue but it sounds very similar. My environment differs slightly from rainlizard. This has occured for me in the past with various 3.x versions. My project consists of multiple threaded processes which perform procedural generation tasks that are queued up and started at scene launch. These are not ongoing tasks but rather some initial generation that prepare the game world (they take around 15-30 seconds, depending on the complexity level I have chosen). Shortly after starting the scene from the editor the output log starts printing the following:
After some time I receive the following:
And the last logs before everything freezes(mixed in with the above logs):
The most important part however is that if I launch the editor from the terminal I am greeted with the following when the scene freezes:
My assumption was that I am doing something wrong which was causing the kernel to kill the process, such as improper care when operating on shared data structures. However, after seeing this issue I thought I would have a deeper look and found the following. If I launch the project directly (executing the godot binary from the project directory) I have NOT experienced any issues with the processes completing. As I mentioned this doesn't always fail but a high percentage of runs do fail. A sample test of 10 runs of each launch method resulted in the following:
If I can provide any further information or assist at all in debugging please let me know. |
For my game I have since switched to using only one Thread (in addition to main Thread) and as a result the errors have become very rare, only occurring once in a blue moon. The more threads you run the higher chance the errors will occur. When I posted this issue I was on 3.11, now on 3.2 it seems "Max Errors Per Frame" has now been changed to "Max Errors Per Second", previously it was generating errors endlessly, up to thousands and would freeze the entire time. Now it still freezes for a moment while it's spitting out the errors but the freezes are much shorter (a second or two) because it only spits out 100 errors at a time, as that's the default in project settings. So this issue has had a small band-aid placed on it I guess. Unfortunately setting "Max Errors Per Second" to 0 isn't reducing the freezes, the freezes still seem to be around the same length as when it spits out 100 errors. But to be clear, only brief freezes are accompanying these errors for me, not crashes. It seems I can generate the errors using only this:
I often have to restart the test a few times, waiting 10 seconds or so to see if the errors appear. It's still very inconsistent. |
Is this still a thing? Threads are a core necessity for my project and I kind of can't afford to have threads be so inconsistent. |
Yes, 3.2-beta5 Here's a test project of the last code snippet I posted. (if you get no errors in the debugger after 10 seconds, restart it, or change number of concurrent threads) |
Having the same issue with 3.2.1 stable release binaries. |
I've been having this same issue. I should mention that it comes up faster whenever I open up the Remote Scene Tree. The Remote Scene Tree can no longer update in my project and is therefore unusable alongside my fairly straightforward Thread Pool script. If I understand correctly, accessing values in Dictionaries and Arrays and the like is thread-safe, but perhaps that has something to do with the Remote Scene Tree piece for me? Pretty sure just having the threads exist is enough to be a problem, though. |
At the moment in Godot 4.1.1.rc1 I'm using multi-threading and having the same issue when click on the remote my game freezes and gave me these errors:
|
Godot version: 3.11
OS/device including version:
Intel Core i7-4790K CPU
16GB ram
Windows 8.1 64bit
Steps to reproduce:
Main scene:
Thread scene:
Minimal reproduction project: Isolate Bug.zip
Issue description:
If you let this run for a while (can take anywhere from 0-30 seconds) the debugger will fill with errors and lock up the game.
The time it takes to generate the errors is inconsistent and so is the amount of errors.
With this code I couldn't get the errors to appear at 50000 loops but it does appear at 100000 loops. To produce these errors I was originally using Vector3s in dictionaries (for terrain gen) but it looks like arrays have the same issue. In my game I get the errors using as little as 15000 loops but there's a lot more other stuff going on so I think it's about the intensity of the process.
This is the usual error:
But I've also seen this on occasion:
I don't know what any of this means. I am unable to use multi-threading as it currently is (the errors are freezing my game). Your help is appreciated.
The text was updated successfully, but these errors were encountered: