Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@vkoby
Copy link
Contributor

@vkoby vkoby commented Sep 14, 2021

What was changed

Removed unnecessary thread interrupt that prevented the sdk from sending the activity task completed call.

Checklist

  1. Closes CleanWorkerShutdownTest::testShutdownNow[Docker] #721

  2. How was this tested:
    Unit test

Copy link
Contributor

@Spikhalskiy Spikhalskiy left a comment

Choose a reason for hiding this comment

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

It looks like this PR cuts off an "interrupted" version of the test instead of fixing anything.

Activity.getExecutionContext().heartbeat("foo");
} catch (ActivityWorkerShutdownException e) {
return "workershutdown";
if (now == null) {
Copy link
Contributor

@Spikhalskiy Spikhalskiy Sep 16, 2021

Choose a reason for hiding this comment

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

Please move these latches code block up from the try{} catch to improve readability.
I believe CountDownLatch#countDown shouldn't throw an InterruptedException

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved, but it does not throw the InterruptedException

@vkoby vkoby requested a review from Spikhalskiy September 16, 2021 20:16
@vkoby vkoby merged commit 7e0c609 into temporalio:master Sep 16, 2021
sojanmathew pushed a commit to sojanmathew/sdk-java that referenced this pull request Oct 19, 2025
  Activities that catch InterruptedException, restore the interrupted flag,
  and continue execution were unable to report their completion due to gRPC call failures.
  This occurred because gRPC calls fail when the thread's interrupted flag is set.
  The fix clears the interrupted flag before making gRPC calls in ActivityWorker.sendReply() and restores it afterward, ensuring:
  - Activity results are successfully reported to the server
  - Thread interruption semantics are preserved for worker shutdown
  - All activity completion scenarios work (success/failure/cancellation)

  Additionally, extract executeGrpcCallWithInterruptHandling() method to eliminate code duplication across the three gRPC response calls,
  improving maintainability and reducing the risk of inconsistent implementations.

  Fixes: temporalio#731
  Related: temporalio#722
sojanmathew added a commit to sojanmathew/sdk-java that referenced this pull request Oct 20, 2025
  Activities that catch InterruptedException, restore the interrupted flag,
  and continue execution were unable to report their completion due to gRPC call failures.
  This occurred because gRPC calls fail when the thread's interrupted flag is set.
  The fix clears the interrupted flag before making gRPC calls in ActivityWorker.sendReply() and restores it afterward, ensuring:
  - Activity results are successfully reported to the server
  - Thread interruption semantics are preserved for worker shutdown
  - All activity completion scenarios work (success/failure/cancellation)

  Additionally, extract executeGrpcCallWithInterruptHandling() method to eliminate code duplication across the three gRPC response calls,
  improving maintainability and reducing the risk of inconsistent implementations.

  Fixes: temporalio#731
  Related: temporalio#722
sojanmathew added a commit to sojanmathew/sdk-java that referenced this pull request Oct 21, 2025
  Activities that catch InterruptedException, restore the interrupted flag,
  and continue execution were unable to report their completion due to gRPC call failures.
  This occurred because gRPC calls fail when the thread's interrupted flag is set.
  The fix clears the interrupted flag before making gRPC calls in ActivityWorker.sendReply() and restores it afterward, ensuring:
  - Activity results are successfully reported to the server
  - Thread interruption semantics are preserved for worker shutdown
  - All activity completion scenarios work (success/failure/cancellation)

  Additionally, extract executeGrpcCallWithInterruptHandling() method to eliminate code duplication across the three gRPC response calls,
  improving maintainability and reducing the risk of inconsistent implementations.

  Fixes: temporalio#731
  Related: temporalio#722
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.

CleanWorkerShutdownTest::testShutdownNow[Docker]

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.