Send 1000 on {:shutdown, :disconnected}#576
Merged
mtrudel merged 2 commits intomtrudel:mainfrom Mar 26, 2026
Merged
Conversation
Owner
|
LGTM! There's a small credo error on code complexity coming out of this; I'll get it resolved and merged later today. Thanks for the PR! |
Owner
|
Published as 1.10.4! |
Contributor
Author
Thank you! |
jimsynz
pushed a commit
to jimsynz/neonfs
that referenced
this pull request
Mar 29, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [bandit](https://hex.pm/packages/bandit) ([source](https://github.com/mtrudel/bandit)) | prod | patch | `1.10.3` → `1.10.4` | --- ### Release Notes <details> <summary>mtrudel/bandit (bandit)</summary> ### [`v1.10.4`](https://github.com/mtrudel/bandit/blob/HEAD/CHANGELOG.md#1104-25-Mar-2026) [Compare Source](mtrudel/bandit@1.10.3...1.10.4) ##### Enhancements - Support `{:shutdown, :disconnected}` as a normal WebSocket result code ([#​576](mtrudel/bandit#576), thanks [@​wwitek-whatnot](https://github.com/wwitek-whatnot)!) </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) in timezone Pacific/Auckland, Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) in timezone Pacific/Auckland. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My45MC4xIiwidXBkYXRlZEluVmVyIjoiNDMuOTAuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUiXX0=--> Reviewed-on: https://harton.dev/project-neon/neonfs/pulls/83 Co-authored-by: Renovate Bot <bot@harton.nz> Co-committed-by: Renovate Bot <bot@harton.nz>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Background
We currently use Cowboy in our production system and tried switching to Bandit. This turned out to not be possible, as we started getting errors on client side, due to sockets being closed with code 1011.
After some investigation we found that this is because we broadcast "disconnect" to the id socket channel, in order to disconnect all user's sockets (as in this example). In Bandit this goes to catch-all
{:stop, reason, websock_state}, while in Cowboy, this goes through adapter here and so is then interpreted as a normal stop reason.This is also very easy to reproduce by just generating two new phoenix apps with a single channel, one using cowboy and one using bandit. Then have a client join the channel, have an
:after_joinself-sent message trigger a disconnect, and observe the code on the client.Proposed change
We'd like to add
{:shutdown, :disconnected}as one of the cases with 1000 code on close, as we believe this would fall under "socket being closed because it's purpose has been fulfilled" as defined in the RFC and definitely doesn't fit 1011's "server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request".