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

Building GridMap in a Thread doesn't work well #42917

Open
lordpeter321 opened this issue Oct 19, 2020 · 5 comments · May be fixed by #63201
Open

Building GridMap in a Thread doesn't work well #42917

lordpeter321 opened this issue Oct 19, 2020 · 5 comments · May be fixed by #63201

Comments

@lordpeter321
Copy link

Godot version:

3.2.3

OS/device including version:

Windows 10 64 bits
NVIDIA GeForce GTX1060
GLES3

Issue description:

What happened

When i build a GridMap in a Thread and send it back to the main thread, sometimes, somes cells are missing.
It's happen randomly ( or seem like it ).

What expected

A fully fill gridmap ready to use

Steps to reproduce:

  1. Create a scene with a gridmap in it
  2. Start a thread and fill the gridmap
  3. send that gridmap back to the main thread
  4. then, add it to the scene tree

Minimal reproduction project:

gridmap_thread.zip

With that demo project, just press the "Start" button to create a gridmap base on a size expose in the "main" node.

@Calinou Calinou changed the title Building Gridmap in Thread doesn't work well Building GridMap in a Thread doesn't work well Oct 19, 2020
@markushonok
Copy link

Is there any progress planned on this bug?

@Calinou
Copy link
Member

Calinou commented Jun 16, 2022

Is there any progress planned on this bug?

Can you reproduce this issue? If so, which Godot version are you using?

That said, nobody knows the cause of this issue, so there is no ETA for fixing this.

@markushonok
Copy link

markushonok commented Jun 16, 2022

Can you reproduce this issue? If so, which Godot version are you using?

That said, nobody knows the cause of this issue, so there is no ETA for fixing this.

Right now I have v3.5.rc2.mono.official [5f9bc7e] installed.
I remember this bug quite a long time ago, probably from 2020 too..
After experimenting a bit I noticed that the location of "wait_to_finish" influences whether this bug happens or not. Here is a simpler project with two options
Test.zip

@markushonok
Copy link

I ran wait_to_finish right after the thread started, thinking it was possible, but it just freezes the main thread, so the bug didn't happen that way

Also an empty archive was sent for some reason, so I'll send it again
Test.zip

@Calinou
Copy link
Member

Calinou commented Jul 17, 2022

See #63106 for a possible explanation as to why this bug happens.

michasng added a commit to michasng/voxel that referenced this issue Jan 8, 2023
GridMap creation and access is not thread safe due to [0] and [1].
However blocks can still be generated on a separate thread and placed on the main thread.

[0] godotengine/godot#42917
[1] godotengine/godot#68597
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants