OkHttpWebsocketSession does not complete the `closeReason` future when closing the websocket in absence of connectivity
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- kotlin
- Ambito
- networking
Direzione di ricerca
Start by reading OkHttpWebsocketSession and the RealWebSocket callbacks mentioned in the issue, focusing on how closeReason is completed by onClosing, onClosed, and onFailure. Reproduce the described disconnect-and-close sequence with ping-pong disabled; done means the coroutine awaiting closeReason terminates when the websocket is closed without connectivity.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello! 👋
I encountered this issue while doing some tests for the reliability of my ktor-based client application.
Reproduction steps
- Initialize a ktor application with websocket and where the built-in ping-pong mechanism is disabled.
- Launch 2 coroutines: Coroutine 1 communicates through websocket with a server external to the machine, Coroutine 2 awaits the completion of the
closeReasonFuture throughDefaultWebSocketSession.closeReason. - Disconnect the machine from the internet.
- Close the websocket.
Actual Behaviour
Coroutine 1 terminates while Coroutine 2 hangs forever.
Expected Behaviour
Coroutine 2 should also terminate, as closeReason should complete.
Analysis
Looking at the code, my understanding of the reason of this behaviour is that, in the OkHttpWebsocketSession class, the closeReason future is completed only in one of these 3 method: onClosing, onClosed, or onFailure.
onFailureis not called by theRealWebSocketimplementation when the connection drops because we disabled the built-in ping/pong mechanism in favour of a custom one.onClosingandonCloseare not called when the websocket is closed unless a control frame (OPCODE_CONTROL_CLOSE) is sent by the server, event that cannot happen under these conditions.
Additional Information
On the other hand, the CIO engine manages to complete the closeReason future under the same assumptions.
Question
Is this a design choice or just a bug due to a very niche condition?
- Lingua principale
- Kotlin
- Stelle
- 47.1k
- Fork
- 9.3k
- Merge medio
- 18h 18m
- PR unite (30g)
- 15
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lysine-dev/okhttp
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
lysine-dev/okhttp#9788 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
lysine-dev/okhttp#9761 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Remove crossinline `addInterceptor` and `addNetworkInterceptor` overloadsForse di nuovo libera @Amir-Golmoradi l’ha presa 7 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
lysine-dev/okhttp#9779 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
HTTP/2 Data padding is not counted toward the connection flow-control window. This deadlocks connections with peers that pad.Forse di nuovo libera @Amir-Golmoradi l’ha presa 7 giorni fa e non c’è nessuna pull request aperta. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
lysine-dev/okhttp#9772 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
lysine-dev/okhttp#9760 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di lysine-dev/okhttp
Issue simili
-
Dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ankidroid/Anki-Android#22555 ·
I maintainer di solito rispondono entro 1 giorno
-
Good first issue: add kotlin-spring-boot stack budget preset (Kotlin + Spring Boot 3 + Gradle)Apertaenhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
core: RAC_LLM_OPTIONS_DEFAULT.min_p disagrees with the IDL's annotated defaultForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug core p3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
RunanywhereAI/runanywhere-sdks#1083 ·
I maintainer di solito rispondono entro 5 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Java and Kotlin (JVM): parse gradle/wrapper/gradle-wrapper.properties with exact line locationsApertaarea: detector eco: java help wanted lane: free-agent roadmap size: S type: parser
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
arminazimi/evergreen#355 ·
I maintainer di solito rispondono entro 1 giorno