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

CommandQueueMT: Fix flush re-entrancy #90470

Merged

Conversation

RandomShaper
Copy link
Member

CommandQueueMT re-entrancy was broken two-fold:

  • First, the collaboration with WorkerThreadPool (thread_enter/exit_command_queue_mt_flush()) doesn't have a concept of stack or ref counting.
  • Second, the read offset was incremented too late, so a re-rentrant call would re-read the flush command that has already been processed.

This PR fixes re-entrancy issues by just early-returning. The result will be the same as if re-entrancy had been detailedly fixed so it was possible without issues, but wihout getting a deeper stack.

Fixes #90363.

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets go forward with this for now. It does fix the crash and most likely will work fine in most cases.

But we need to decide if the implied ordering of commands resulting from this PR is what we want (I think it is).

@akien-mga akien-mga merged commit 8ec0372 into godotengine:master Apr 11, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@RandomShaper RandomShaper deleted the fix_cmd_queue_mt_reentrancy branch April 11, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when running project with error ERROR: Condition "flushing_cmd_queue != nullptr" is true.
3 participants