godotengine/godot

Gdnative Multithreaded Crash when using different functions from same gdnative file in different threads

Opened this issue · 0 comments

Godot version

3.4.stable

System information

Windows 10, GLES3, Intel 11th Generation Graphics (30.0.100.9864)

Issue description

Godot seems to crash when different functions from the same gdnative file are called in different threads. There does not seem to be a crash or other issue when the same function is what is called in both of the threads. I would expect that the functions in a gdnative file could be accessed from any number of threads with no crash. I understand this may not be fixable or desirable to fix since gdnative is being replaced by extensions in 4.0. There should at least be a warning in the documentation about this if this is to be expected though since it is confusing to figure out that this is what is causing the crash.

Steps to reproduce

Create a project with one node with a gdscript script and another node with a gdnative script with at least two accessible functions in the gdnative script. Create a thread in gdscript. Call one of the functions from the main thread at the same time as the other function is accessed by the other thread.

To run the project, press play. It should crash after a few seconds.

Minimal reproduction project

https://mega.nz/file/0UwUFJ7T#eU5jPehOe1zLIcJYGYu4ueJMS-FmSxjqHz9F3xUGbrU