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

Fix tracing regression #707

Merged
merged 3 commits into from
Sep 2, 2021
Merged

Fix tracing regression #707

merged 3 commits into from
Sep 2, 2021

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Sep 2, 2021

In #697 we started using formatter-specific JsonRpcRequest objects on the transmitting side. This causes RPC requests with arguments to fail when ETW tracing is enabled because they try to read arguments using code that was only designed to do so with deserialized messages rather than the one created to be transmitted.

The fix is to avoid trying to deserialize outbound arguments. We could have done an if check within the JsonRpcRequest-derived classes, but it seemed more complete and safe to just stop reusing classes that were written only with deserialization in mind by creating a far simpler outbound-only request class.

We had a test hole in the ETW case which this PR (and #706) fills.

@AArnott AArnott added this to the v2.9 milestone Sep 2, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2021

Codecov Report

Merging #707 (58f5bf1) into main (a9cd051) will increase coverage by 1.60%.
The diff coverage is 95.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #707      +/-   ##
==========================================
+ Coverage   89.96%   91.56%   +1.60%     
==========================================
  Files          60       60              
  Lines        5162     5182      +20     
==========================================
+ Hits         4644     4745     +101     
+ Misses        518      437      -81     
Impacted Files Coverage Δ
src/StreamJsonRpc/MessagePackFormatter.cs 92.21% <94.44%> (-0.35%) ⬇️
src/StreamJsonRpc/JsonMessageFormatter.cs 91.02% <100.00%> (-0.71%) ⬇️
src/StreamJsonRpc/JsonRpcEventSource.cs 94.52% <100.00%> (+90.29%) ⬆️
src/StreamJsonRpc/Reflection/RpcTargetInfo.cs 92.39% <0.00%> (+0.38%) ⬆️
src/StreamJsonRpc/HeaderDelimitedMessageHandler.cs 88.75% <0.00%> (+1.18%) ⬆️
src/StreamJsonRpc/Protocol/JsonRpcRequest.cs 86.00% <0.00%> (+2.00%) ⬆️
src/StreamJsonRpc/JsonRpc.cs 94.13% <0.00%> (+2.26%) ⬆️
src/StreamJsonRpc/RequestId.cs 72.41% <0.00%> (+3.44%) ⬆️
... and 3 more

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 a9cd051...58f5bf1. Read the comment docs.

In microsoft#697 we started using formatter-specific JsonRpcRequest objects on the transmitting side. This causes RPC requests with arguments to fail when ETW tracing is enabled because they try to read arguments using code that was only designed to do so with deserialized messages rather than the one created to be transmitted.

The fix is to avoid trying to deserialize outbound arguments. We could have done an `if` check within the `JsonRpcRequest`-derived classes, but it seemed more complete and safe to just stop reusing classes that were written only with deserialization in mind by creating a far simpler outbound-only request class.
@AArnott AArnott marked this pull request as ready for review September 2, 2021 15:52
[IgnoreDataMember]
public TopLevelPropertyBag? TopLevelPropertyBag { get; set; }

public override bool TrySetTopLevelProperty<T>(string name, [MaybeNull] T value)
Copy link
Member

Choose a reason for hiding this comment

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

Now that inbound/outbound is separate, do we need to implement TrySetTopLevelProperty on the inbound object?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe not. But inbound messages become outbound messages in the remote target relay case. That isn't adequately tested, I'm learning, so I didn't want to risk regressing it.

Copy link
Member

Choose a reason for hiding this comment

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

Right, I remember that case now from unit tests. Does the relay case only work with json messages or do we support with message pack as well? I am now curious if it would work with messagepack and top level properties since we had different inbound/outbound dictionaries in message pack case.


public TopLevelPropertyBag? TopLevelPropertyBag { get; set; }

public override bool TrySetTopLevelProperty<T>(string name, [MaybeNull] T value)
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as the Json requests messages here regarding TrySetTopLevelProperty implementation in the inbound one

Copy link
Member Author

Choose a reason for hiding this comment

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

Same response, but especially true here, since remote RPC target tests don't run on messagepack at all.

@AArnott AArnott merged commit 16899cb into microsoft:main Sep 2, 2021
@AArnott AArnott deleted the testWitTracing2.9 branch September 2, 2021 17:31
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.

3 participants