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

ServiceCipher shouldn't implement/derive Clone #95

Open
rubdos opened this issue May 1, 2021 · 0 comments
Open

ServiceCipher shouldn't implement/derive Clone #95

rubdos opened this issue May 1, 2021 · 0 comments

Comments

@rubdos
Copy link
Member

rubdos commented May 1, 2021

ServiceCipher: Clone implies that I can concurrently process two messages that should've been processed sequentially. Even considering that the underlying storage mechanism is synchronised/mutex'd, that's not enough: the synchronisation mechanism cannot protect against readA-readB-writeA-writeB internally.

The simplest mitigation would be to Arc<Mutex> the complete insides of ServiceCipher, the coolest would be by considering the session that needs to be accessed:
we could lock only a single session to enforce serialized access.
That's a lot of code though.

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

No branches or pull requests

1 participant