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

Remove client side check against server info max_payload when publishing #781

Merged
merged 3 commits into from
Jun 7, 2023

Conversation

scottf
Copy link
Collaborator

@scottf scottf commented Jun 7, 2023

No description provided.

@scottf scottf requested a review from aricart June 7, 2023 21:04
@@ -99,7 +99,7 @@ internal enum ClientProtcolVersion
// encoded conn rather than using this class as
// a base class. This can happen anytime as we are using
// interfaces.
public class Connection : IConnection, IDisposable
public class Connection : IConnection
Copy link
Collaborator Author

@scottf scottf Jun 7, 2023

Choose a reason for hiding this comment

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

While I was in here, IConnection is already IDisposable

// Proactively reject payloads over the threshold set by server.
if (count > info.MaxPayload)
throw new NATSMaxPayloadException();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the change. info is Server info. Simply don't check it.

@@ -2680,8 +2676,6 @@ internal void PublishImpl(string subject, string reply, MsgHeader inHeaders, byt
/// to the connected NATS server.</param>
/// <exception cref="NATSBadSubscriptionException"><paramref name="subject"/> is
/// <c>null</c> or entirely whitespace.</exception>
/// <exception cref="NATSMaxPayloadException"><paramref name="data"/> exceeds the maximum payload size
/// supported by the NATS server.</exception>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed api doc since this exception is not thrown anymore. There are 34 total of this exact change.

}
});
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only thing that happens is the connection gets closed. There probably is an error message sent from the server, but the connection is already closed so it never bubbles up. Not sure if this is great.

Copy link
Member

Choose a reason for hiding this comment

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

A different issue, but I'm wondering there is a way to pull the remaining data from the 1/2 closed TCP socket. Doubtful, but it'd be interesting to look into for error conditions like this.


using (NATSServer.CreateJetStreamFast())
{
Assert.Throws<NATSJetStreamException>(() =>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Synchronous publishes get an exception.

}
}
Assert.True(receivedDisconnect);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Asynchronous publishes do not an exception, but the connection is closed.

@scottf scottf requested a review from ColinSullivan1 June 7, 2023 21:13
Copy link
Member

@ColinSullivan1 ColinSullivan1 left a comment

Choose a reason for hiding this comment

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

LGTM.

@scottf scottf merged commit e03c172 into master Jun 7, 2023
@scottf scottf deleted the remove_max_payload_check branch June 7, 2023 23:56
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.

2 participants