SocketWriteBuffer: only throw buffer error once per channel #13665
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs #13662
What it does
I'm not really satisfied with this patch, as I was hoping we could only block the "logging" part of the issue. But since the
Max disconnected buffer size exceeded
is handled pretty late, it's hard to prevent multiple logs while still throwing the exception; so I'm only throwing the exception once, and then silently ignoring following errors, which is a bit awkward. I'm not quite sure how to properly solve this issue.Regarding the exported types, I would be tempted to also change the visibility of some fields in both classes (
ReconnectableSocketChannel
andSocketWriteBuffer
) from private to protected; as without this, actually overriding the behavior is pretty difficult. Thoughts?How to test
See #13662
Follow-ups
If we could detect that the client "closed" or "refreshed" the tab (as opposed to "lost connection"), we could probably immediately clean up the session. Even if the client reopens the tab, it will happen with a different frontendId, so it will not rely on the disconnected socket buffer. However, this is probably a more complex task.
Review checklist
Reminder for reviewers