juniper_warp: panic when connection reset

Created on 27 Mar 2020  路  5Comments  路  Source: graphql-rust/juniper

Describe the bug

thread 'tokio-runtime-worker' panicked at 'Websocket receive error: WebSocket protocol error: Connection reset without closing handshake', ....cargogitcheckoutsjuniper-aa5e857cd28538c7cab6decjuniper_warpsrclib.rs:495:46

To Reproduce

Not sure. But I guess reset a connection when sending websocket frame could reproduce.

Expected behavior

Don't panic because one connection is reset.

Additional context

https://github.com/graphql-rust/juniper/blob/6e4bc127b05dc29f7832cbf468c9fb2bc18f78ec/juniper_warp/src/lib.rs#L495

bug needs-triage

All 5 comments

@nWacky

@spacemeowx2,

I looked it up.

For now it's unclear how to handle errors when dealing with channels. For now, it creates a new channel which returns all messages to end user and keeps executing logic inside ForEach future. Because ForEach expects return type of Future<Output = ()>, it's not possible to return errors in there => it's not possible to return errors for now (a potential workaround could be by implemeting custom future that drives iterator to completion).

For now, I can change juniper_warp's subscriptions impl so that it ignores errors. Over the longer term, it would be better to add full support for subscriptions over ws protocol and return an error if connection reset without closing handshake or something else happens

Would an optional dependency using https://github.com/tokio-rs/async-stream help?

What about using fold instead of for_each?

fold worked, didn't think of it.

591 should resolve the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

librelois picture librelois  路  3Comments

takeit picture takeit  路  5Comments

beevans picture beevans  路  4Comments

ysimonson picture ysimonson  路  5Comments

snnsnn picture snnsnn  路  4Comments