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

Infinite loop on Websocket.Wsd.close with close code #61

Open
aantron opened this issue Dec 1, 2023 · 2 comments
Open

Infinite loop on Websocket.Wsd.close with close code #61

aantron opened this issue Dec 1, 2023 · 2 comments

Comments

@aantron
Copy link

aantron commented Dec 1, 2023

I haven't fully diagnosed this yet, and I'm happy to continue to do so, but I'd like to open it in case you can eyeball the issue.

Dream eventually calls Websocketaf.Wsd.close ~code:(`Other code) socket in response to the client closing the WebSocket. As I understand it, it's normal to attempt to send a close code from the server in an attempt to perform the WebSocket close handshake.

This seems to trigger an infinite loop in WebSocket. Omitting ~code:(`Other code) causes the server to close the WebSocket successfully without getting stuck in an infinite loop.

This wasn't the behavior as of 2021. Looking at the blame for this code

https://github.com/anmonteiro/websocketaf/blob/28abb768916f606287a2eb05a5d6a4aa11ec31b6/lib/wsd.ml#L110-L125

...specifically, the Some code case, I wonder if you can spot whether any of these commits could be triggering this infinite loop behavior:

If not, I can proceed with direct debugging, or git bisect (which requires me to rebase the renaming commits or unvendor websocket/af into a Dune workspace).

@aantron
Copy link
Author

aantron commented Dec 1, 2023

See aantron/dream#230 and aantron/dream#222.

@anmonteiro
Copy link
Owner

I'd love to fix this is it's still an issue. do you have a minimal repro I can try?

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

2 participants