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

Exposed websocket max_message_size through ConnectionOptions #189

Merged
merged 2 commits into from
May 20, 2023

Conversation

criminosis
Copy link
Contributor

Hey @wolf4ood I bumped into what seems to be an implicit default that wasn't exposed by this crate. These functions:

https://github.com/wolf4ood/gremlin-rs/blob/master/gremlin-client/src/connection.rs#L51
https://github.com/wolf4ood/gremlin-rs/blob/master/gremlin-client/src/aio/connection.rs#L133-L136

Appeared to be leveraging tungstenite's default websocket settings by using the method that didn't specify a websocket config:

https://github.com/snapview/tungstenite-rs/blob/371f8230444e209cc37ec481e94d621eddf5f0af/src/tls.rs#L180
https://github.com/sdroege/async-tungstenite/blob/2365647978412f47e681d498f25b8469f4355f11/src/tokio.rs#L267

This None then becomes the defaults defined by tungstenite: https://github.com/snapview/tungstenite-rs/blob/master/src/protocol/mod.rs#L39-L70

I was having I/O issues bumping into these implicit limits. Fwiw they are "supposed" to be configured to the target graph provider's max_message_size, and JanusGraph at least sets its default to just 65k, obviously way less than the 64MiB implicitly being used from tungstenite.

I tried to mimic prior builders / config patterns, but happy to make any changes.

If accepted & merged mind cutting a new release?

Comment on lines +183 to +186
/// The maximum size of a message. `None` means no size limit. The default value is 64 MiB.
pub(crate) max_message_size: Option<usize>,
/// The maximum size of a single message frame. `None` means no size limit. The limit is for
/// frame payload NOT including the frame header. The default value is 16 MiB.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just forwarded the defaults that were implicit from tungstenite to be consistent to today's behavior.

Copy link
Owner

@wolf4ood wolf4ood left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@wolf4ood wolf4ood merged commit 7db0f82 into wolf4ood:master May 20, 2023
@criminosis criminosis deleted the expose_message_size_limits branch May 20, 2023 19:29
@criminosis
Copy link
Contributor Author

@wolf4ood Thank you!

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