Skip to content

Fix thread deadlock during TestExecutor teardown when test_state is None. - #1311

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_953449774
Jul 27, 2026
Merged

Fix thread deadlock during TestExecutor teardown when test_state is None.#1311
copybara-service[bot] merged 1 commit into
masterfrom
test_953449774

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Fix thread deadlock during TestExecutor teardown when test_state is None.

When TestState fails during initialization (e.g. InvalidPlugError for unsubstituted placeholders), self.test_state remains None. During thread teardown in the finally block, accessing self.running_test_state raised a secondary TestStopError, which prevented self._execution_finished.set() from being called and caused test.execute() to hang indefinitely until test timeout.

This change guards against None test_state in teardown and close(), and wraps teardown in a try/finally block so _execution_finished.set() is always signaled.

…one.

When TestState fails during initialization (e.g. InvalidPlugError for unsubstituted placeholders), self.test_state remains None. During thread teardown in the finally block, accessing self.running_test_state raised a secondary TestStopError, which prevented self._execution_finished.set() from being called and caused test.execute() to hang indefinitely until test timeout.

This change guards against None test_state in teardown and close(), and wraps teardown in a try/finally block so _execution_finished.set() is always signaled.

PiperOrigin-RevId: 954728594
@copybara-service
copybara-service Bot merged commit 471011e into master Jul 27, 2026
1 check passed
@copybara-service
copybara-service Bot deleted the test_953449774 branch July 27, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant