binance / binance/binance-connector-java
`NoSuchElementException` from `ServiceLoader` in Async Context
- Lingua principale
- Java
- Stelle
- 581
- Fork
- 255
- Merge medio
- 1m
- PR unite (30g)
- 1
Descrizione
This report details a critical runtime exception encountered for derivatives trading (USDS Futures) within a Play Framework 3 / Pekko environment.
When initializing the WebSocket client within a `CompletableFuture` (e.g., on Play's default `ForkJoinPool`), the `ServiceLoader` mechanism fails to find Jetty WebSocket extension implementations.
- **Error:** `java.util.NoSuchElementException` originating from `java.util.ServiceLoader` and traced up through `org.eclipse.jetty.websocket.api.ExtensionConfig.getParser`.
- **Cause:** The `ServiceLoader` relies on the `Thread.currentThread().getContextClassLoader()`. When the initialization code runs on a worker thread from a thread pool (like `ForkJoinPool`), this context classloader may not have visibility of the full application dependency classpath where the Jetty service implementations reside.
- **Trigger:** Instantiating `new DerivativesTradingUsdsFuturesWebSocketStreams(wsConnectionPool)` inside a `CompletableFuture.supplyAsync()` block.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia tracciando DerivativesTradingUsdsFuturesWebSocketStreams quando viene creato all’interno di CompletableFuture.supplyAsync(), quindi esamina ServiceLoader e org.eclipse.jetty.websocket.api.ExtensionConfig.getParser nel contesto Play/Pekko segnalato. Riproduci il fallimento su un worker di ForkJoinPool e conferma in che modo differisce il classloader del contesto; il report non definisce né la correzione prevista né un test di completamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- api, backend, networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 28/100