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

Make thread stopping in ThreadBasedExecutor more safe #2503

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

IlyaMuravjov
Copy link
Collaborator

Description

Previously ThreadBasedExecutor:

  • wasn't actually killing timed out threads (ThreadDeath was caught by kotlin.runCatching)
  • wasn't waiting for old thread to die before starting a new one, causing race condition
  • was able to forcefully stop() a thread even during clean up operations, causing java.lang.IllegalStateException: Cannot start new transaction without ending existing transaction

How to test

Manual tests

Generate integration tests for OrderService from spring-boot-testing project with low hanging test time out.

image

There should be no Caused by: java.lang.IllegalStateException: Cannot start new transaction without ending existing transaction.

Some time out tests should generate.

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

…stop()` during while executing clean up callback
@IlyaMuravjov IlyaMuravjov added comp-instrumented-process Issue is related to Instrumented process ctg-bug-fix PR is fixing a bug comp-spring Issue is related to Spring projects support labels Aug 14, 2023
@EgorkaKulikov EgorkaKulikov merged commit 188f682 into main Aug 15, 2023
35 checks passed
@EgorkaKulikov EgorkaKulikov deleted the ilya_m/safer_thread_stop_on_timeout branch August 15, 2023 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-instrumented-process Issue is related to Instrumented process comp-spring Issue is related to Spring projects support ctg-bug-fix PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants