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

MultiplexingStream transmit errors when shutting down channels #517

Merged
merged 86 commits into from
Sep 20, 2022
Merged
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
2df4bb9
Read exception being received but not thrown
sarda-devesh May 30, 2022
439906b
Basic Error Test
sarda-devesh May 31, 2022
50aeb0f
Update test to make sure error message is received
sarda-devesh May 31, 2022
5410649
Added while loop in error test
sarda-devesh Jun 1, 2022
80b899e
Implemented basic interface for error serialization
sarda-devesh Jun 5, 2022
e9b529f
Added in locking for Dispose in MultiplexingStream.Channel and revert…
sarda-devesh Jun 9, 2022
e860c10
Merge branch 'AArnott:main' into main
sarda-devesh Jun 9, 2022
d2b6a00
Updated SDK version locally
sarda-devesh Jun 9, 2022
4cc7a2d
Implemented custom serialization using messagepack
sarda-devesh Jun 14, 2022
d3560e1
Added support for write error only in V2 and V3
sarda-devesh Jun 18, 2022
89d6744
Accepted all incoming changes
sarda-devesh Jun 23, 2022
409c07a
Merge branch 'AArnott-main' into main
sarda-devesh Jun 23, 2022
33be374
Removed all changes in current branch
sarda-devesh Jun 23, 2022
19fc8f3
Reimplemented formatter code for messpack to write error interaction
sarda-devesh Jun 23, 2022
8d3e2b8
Rewrote client side code of dealing content write error
sarda-devesh Jun 23, 2022
b379da9
Rewrote code on remote to process write error but not close stream
sarda-devesh Jun 23, 2022
738e67b
Implemented sketch solution to get OfferPipeWithError to pass
sarda-devesh Jun 23, 2022
61a6edd
Changed dispose to close writer with exception if exception passed in…
sarda-devesh Jun 25, 2022
2b86c2d
Changed to using faulting exception instead of custom created field
sarda-devesh Jun 28, 2022
1cc3272
Updated formatter for error message
sarda-devesh Jul 25, 2022
425a208
Modified formatter to handle errors
sarda-devesh Jul 25, 2022
90f0fd3
Implemented error handling in the channel
sarda-devesh Jul 25, 2022
d3d270d
Wrote unit test
sarda-devesh Jul 25, 2022
783068c
Passing basic error test
sarda-devesh Jul 25, 2022
7e1ba18
Merge branch 'main' of https://github.com/AArnott/Nerdbank.Streams in…
sarda-devesh Jul 25, 2022
c95905b
Resolved merge conflict?
sarda-devesh Jul 25, 2022
8b0e062
Merge pull request #3 from sarda-devesh/devesh/main
sarda-devesh Jul 25, 2022
9a28a50
Updated documentation
sarda-devesh Jul 25, 2022
d2ed543
Channels get completed with errors
sarda-devesh Jul 25, 2022
7d23ff7
Changed C# Stream to complete with errors
sarda-devesh Jul 30, 2022
75496f7
Added public field of remote exception to easily access remote error
sarda-devesh Jul 30, 2022
9116de1
Added interop test to ensure that error is sent properly
sarda-devesh Jul 30, 2022
7932c26
Changed C# code to not have public field
sarda-devesh Aug 3, 2022
e6ffbec
Code push
sarda-devesh Aug 5, 2022
9ba19a7
Code save
sarda-devesh Aug 5, 2022
1f6e252
Changed back to basic state
sarda-devesh Aug 5, 2022
317d1eb
Complete restore try
sarda-devesh Aug 5, 2022
1a64f90
Downloaded code from upstream master
sarda-devesh Aug 5, 2022
0e9656c
Changed formatter to support formatting error messages
sarda-devesh Aug 9, 2022
9448156
Added code on the remote to receive exceptions from the sender
sarda-devesh Aug 9, 2022
26add64
Remote side completes with an error test passing
sarda-devesh Aug 9, 2022
27d56a7
All MultiplexingStream tests passing
sarda-devesh Aug 10, 2022
61ca8ff
v2 Interop tests passing
sarda-devesh Aug 18, 2022
b8721f4
Passing all typescript tests
sarda-devesh Aug 18, 2022
e4f8cea
Including changes in Nerdbank.Stream
sarda-devesh Aug 18, 2022
626242e
All C# tests passsing
sarda-devesh Aug 18, 2022
00dd45c
Fixed style issues in C# code
sarda-devesh Aug 20, 2022
a8c5fbd
Fixed typescript style issue
sarda-devesh Aug 20, 2022
f9ed5a2
Added comments to C# test
sarda-devesh Aug 20, 2022
ed2d5d6
Added a writing error class
sarda-devesh Aug 20, 2022
270a484
Updated writing error class in C#
sarda-devesh Aug 20, 2022
da0f302
Merge branch 'AArnott:main' into main
sarda-devesh Aug 20, 2022
6cd7a62
Fixed linter issues
sarda-devesh Aug 20, 2022
1c92e32
Some doc and syntax touch-ups
AArnott Aug 25, 2022
6b3691e
More syntax touch-ups
AArnott Aug 25, 2022
2021f29
Fix a regression my recent syntax changes made
AArnott Aug 25, 2022
06adacf
Fix doc comment
AArnott Aug 25, 2022
1e87e00
Fixed style issues
sarda-devesh Aug 25, 2022
782ad6d
Revert namespace change
sarda-devesh Aug 25, 2022
d6ec961
Fixed build errors
sarda-devesh Aug 25, 2022
0586aeb
Switched to using protocol version for cast checking
sarda-devesh Aug 27, 2022
562caf2
Added fault method
sarda-devesh Aug 27, 2022
3e4baf8
Fixed formatter mismatch
sarda-devesh Aug 27, 2022
d8dcb0c
Moved newly added tests with other tests
sarda-devesh Aug 29, 2022
64a3e03
Merge branch 'AArnott:main' into main
sarda-devesh Sep 15, 2022
2aaea24
Added check for channel dispoal before sending of error
sarda-devesh Sep 17, 2022
d0a63e5
Code push to see error in pipeline
sarda-devesh Sep 17, 2022
bafac8a
Fixed uncessary lock acquisiton
sarda-devesh Sep 18, 2022
3b7352b
Tried to get error to show up locally
sarda-devesh Sep 19, 2022
ebf0903
Added trace statements for better error visibility
sarda-devesh Sep 19, 2022
b33e34e
Changed channel options error to be more verbose
sarda-devesh Sep 19, 2022
3de306f
Merge branch 'AArnott:main' into main
sarda-devesh Sep 19, 2022
fd44d7e
Tried to fix race condition
sarda-devesh Sep 20, 2022
738add2
Only swallow exception if it was not user specified
sarda-devesh Sep 20, 2022
a2eae37
Retrigger build pipeline
sarda-devesh Sep 20, 2022
53a142b
Add check in TryAcceptOffer that channel is disposed
sarda-devesh Sep 20, 2022
29fc1f8
Verify that it was an object disposed exception
sarda-devesh Sep 20, 2022
3ab4f46
Revert to old state to check for disposal
sarda-devesh Sep 20, 2022
b38d67b
Retrigger build pipeline try 2
sarda-devesh Sep 20, 2022
b0248f5
Checked for acceptance transition to faulted
sarda-devesh Sep 20, 2022
d9f4933
Added log message inside AcceptChannelOrThrow
sarda-devesh Sep 20, 2022
9c3360b
Retrigger build pipeline try 3
sarda-devesh Sep 20, 2022
9b40d83
Check for both acceptance and completion
sarda-devesh Sep 20, 2022
125e2fa
Pipeline rebuild
sarda-devesh Sep 20, 2022
f6819e9
Keep track of channel acceptance in process outbound
sarda-devesh Sep 20, 2022
a2aef17
Touch-ups
AArnott Sep 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed uncessary lock acquisiton
  • Loading branch information
sarda-devesh committed Sep 18, 2022
commit bafac8aaa7a30352795ae1ffccdd399861b4d182
21 changes: 4 additions & 17 deletions src/Nerdbank.Streams/MultiplexingStream.Channel.cs
Original file line number Diff line number Diff line change
@@ -582,9 +582,7 @@ internal bool TryAcceptOffer(ChannelOptions channelOptions)
this.localWindowSize ??= channelOptions.ChannelReceivingWindowSize is long windowSize ? Math.Max(windowSize, this.MultiplexingStream.DefaultChannelReceivingWindowSize) : this.MultiplexingStream.DefaultChannelReceivingWindowSize;
}

TraceSource traceSrc = new TraceSource($"{nameof(Streams.MultiplexingStream)}.{nameof(Channel)} {this.QualifiedId} ({this.Name}) TryAcceptOffer", SourceLevels.Critical);
var acceptanceParameters = new AcceptanceParameters(this.localWindowSize.Value);

if (this.acceptanceSource.TrySetResult(acceptanceParameters))
{
if (this.QualifiedId.Source != ChannelSource.Seeded)
@@ -609,16 +607,8 @@ internal bool TryAcceptOffer(ChannelOptions channelOptions)
{
// A (harmless) race condition was hit.
// Swallow it and return false below.
if (traceSrc.Switch.ShouldTrace(TraceEventType.Critical))
{
traceSrc.TraceEvent(TraceEventType.Critical, (int)TraceEventId.WriteError, "Rejecting channel offer due to ObjectDisposedException exception");
}
}
}
else if (traceSrc.Switch.ShouldTrace(TraceEventType.Critical))
{
traceSrc.TraceEvent(TraceEventType.Critical, (int)TraceEventId.WriteError, "Rejecting channel offer due to trySetResult failure");
}

return false;
}
@@ -920,22 +910,19 @@ private async Task ProcessOutboundTransmissionsAsync()
{
// Send the completion message to the remote if the channel hasn't been disposed
bool canSendCompletionMessage;

// Restore the PipeReader to the field.
lock (this.SyncObject)
{
this.mxStreamIOReader = mxStreamIOReader;
mxStreamIOReader = null;
canSendCompletionMessage = !this.isDisposed;
}

if (canSendCompletionMessage)
{
this.MultiplexingStream.OnChannelWritingCompleted(this);
}

// Restore the PipeReader to the field.
lock (this.SyncObject)
{
this.mxStreamIOReader = mxStreamIOReader;
mxStreamIOReader = null;
}
}
}