8000 Disconnect clients in case of inappropriate protocol by FZambia · Pull Request #256 · centrifugal/centrifuge · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Disconnect clients in case of inappropriate protocol #256

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

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

FZambia
Copy link
Member
@FZambia FZambia commented Sep 11, 2022

Currently we have a problem when publishing a binary message and having JSON-protocol connection – publications to channel do not work (return an error) in case of Memory engine (since broadcast is synchronous at the moment). In case of Redis engine there is a chance that only some connections will receive the data until we hit an encoding error (in Redis Engine case broadcast is asynchronous upon reading from PUB/SUB).

This is due to the fact that we can't serialize binary to JSON – so broadcasting obviously returns an error. That's usually a programmer error, all connections should be Protobuf-based to properly work with binary. But this can also happen occasionally during migration from JSON to binary formats. So users come across weird behaviour here which can not be fixed easily (as clients continue reconnecting).

Here we are disconnecting clients which can not handle binary payload with 3506: inappropriate protocol Disconnect instead of returning an error on publish. So valid connections will work, invalid connections will be disconnected.

Problem like this should usually be detected on development stage. We also log about suc AB27 h cases on WARN level (with the first observed client ID and user ID).

We also disconnect in cases when we can not serialize Reply or Unidirectional Push for single Client.

Probably this may be addressed in some alternative form – though do not have any good ideas at the moment.

@FZambia FZambia changed the title Inappropriate protocol disconnects Disconnect clients in case of inappropriate protocol Sep 11, 2022
@FZambia FZambia merged commit f9fe49d into master Sep 13, 2022
@FZambia FZambia deleted the insufficient_protocol branch September 13, 2022 06:40
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.

1 participant
0