Skip to content

Change Actor gRPC client to async.#564

Merged
artursouza merged 2 commits into
dapr:masterfrom
artursouza:fix_blocking_actor_client
Jun 14, 2021
Merged

Change Actor gRPC client to async.#564
artursouza merged 2 commits into
dapr:masterfrom
artursouza:fix_blocking_actor_client

Conversation

@artursouza

Copy link
Copy Markdown
Contributor

Description

Change Actor gRPC client to async.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #562

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@artursouza artursouza requested review from halspang and wcs1only June 11, 2021 07:13
@codecov

codecov Bot commented Jun 11, 2021

Copy link
Copy Markdown

Codecov Report

Merging #564 (fb023d5) into master (9ce75d9) will increase coverage by 0.09%.
The diff coverage is 93.54%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #564      +/-   ##
============================================
+ Coverage     80.52%   80.61%   +0.09%     
- Complexity      981      985       +4     
============================================
  Files            88       88              
  Lines          3024     3039      +15     
  Branches        331      332       +1     
============================================
+ Hits           2435     2450      +15     
+ Misses          423      422       -1     
- Partials        166      167       +1     
Impacted Files Coverage Δ
...ain/java/io/dapr/actors/client/DaprGrpcClient.java 93.54% <93.33%> (+6.04%) ⬆️
...c/main/java/io/dapr/actors/client/ActorClient.java 59.09% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d056d9a...fb023d5. Read the comment docs.

Comment on lines +85 to +86
if (daprApiToken != null) {
metadata.put(Metadata.Key.of("dapr-api-token", Metadata.ASCII_STRING_MARSHALLER), daprApiToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a negative case if the token is empty? Or is this related to the feature that has to be enabled and if it's not we hit the null (expected) case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We hit null if not set. If it is set as empty, it is OK to pass it through.

@halspang halspang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good to me. Just a quick question on how the token works.

ExecutionException.class,
"UNKNOWN",
"UNKNOWN: java.lang.ArithmeticException",
"UNKNOWN: ",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This has to do with how Exceptions are handled in the grpc library, it does not show the exception as it would in the blocking path.

callWithRetry(() -> {
assertThrowsDaprExceptionSubstring(
"INTERNAL",
"INTERNAL: error invoke actor method: error from actor service",

@artursouza artursouza Jun 11, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When testing as an integration test, we got the error message, but the original exception is not displayed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This behavior is observed prior to this change as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like a fine error to me. Just curious, would the actual error be displayed anywhere? For instance, in the dapr runtime?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should be logged in Dapr runtime. The whole error handling for dapr is something that is not proper designed in the APIs today.

@wcs1only wcs1only left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@artursouza artursouza merged commit 5c05f3d into dapr:master Jun 14, 2021
fackee pushed a commit to fackee/java-sdk that referenced this pull request Mar 28, 2022
Signed-off-by: zjx244729 <zjx244729@alibaba-inc.com>
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.

Blocking call detected by BlockHound when invoke Actor methods, and access actorStateManager methods

3 participants