Open SametKAYIRAN opened 3 years ago
Hi, we need to manage on com.kucoin.sdk.websocket.listener.KucoinPrivateWebsocketListener the "onFailure" method. Actually simply print an exception, while it need to call the "onFailure" method on the appropriate callback. I'm trying to implement it.
Hi, please try to apply my PR https://github.com/Kucoin/kucoin-java-sdk/pull/56
Although I applied the solution, https://github.com/Kucoin/kucoin-java-sdk/pull/41, while socket running gets the exception below. The socket can work for a maximum of 1 day without any errors. Are there any ways to solve this problem or auto reconnect again when the exception occurs?
2021-05-29 03:14:24.151 ERROR 13061 --- [.kucoin.com/...] c.k.s.w.l.KucoinPublicWebsocketListener : Error on private socket
javax.net.ssl.SSLException: Connection reset at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127) ~[na:na] at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:349) ~[na:na] at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:292) ~[na:na] at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:287) ~[na:na] at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:144) ~[na:na] at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1421) ~[na:na] at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1386) ~[na:na] at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:973) ~[na:na] at okio.Okio$2.read(Okio.java:140) ~[okio-1.17.2.jar!/:na] at okio.AsyncTimeout$2.read(AsyncTimeout.java:237) ~[okio-1.17.2.jar!/:na] at okio.RealBufferedSource.request(RealBufferedSource.java:72) ~[okio-1.17.2.jar!/:na] at okio.RealBufferedSource.require(RealBufferedSource.java:65) ~[okio-1.17.2.jar!/:na] at okio.RealBufferedSource.readByte(RealBufferedSource.java:78) ~[okio-1.17.2.jar!/:na] at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.java:117) ~[okhttp-3.14.9.jar!/:na] at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:101) ~[okhttp-3.14.9.jar!/:na] at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:273) ~[okhttp-3.14.9.jar!/:na] at okhttp3.internal.ws.RealWebSocket$1.onResponse(RealWebSocket.java:209) ~[okhttp-3.14.9.jar!/:na] at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174) ~[okhttp-3.14.9.jar!/:na] at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) ~[okhttp-3.14.9.jar!/:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na] Suppressed: java.net.SocketException: Broken pipe (Write failed) at java.base/java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:na] at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110) ~[na:na] at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150) ~[na:na] at java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81) ~[na:na] at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:380) ~[na:na] ... 20 common frames omitted Caused by: java.net.SocketException: Connection reset at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186) ~[na:na] at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140) ~[na:na] at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478) ~[na:na] at java.base/sun.security.ssl.SSLSocketInputRecord.readFully(SSLSocketInputRecord.java:461) ~[na:na] at java.base/sun.security.ssl.SSLSocketInputRecord.decodeInputRecord(SSLSocketInputRecord.java:243) ~[na:na] at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:181) ~[na:na] at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:110) ~[na:na] ... 17 common frames omitted