bitrich-info / xchange-stream

XChange-stream is a Java library providing a simple and consistent streaming API for interacting with Bitcoin and other crypto currency exchanges via WebSocket protocol. It is build on top of of XChange library providing new interfaces for streaming API. User can subscribe for live updates via reactive streams of RxJava library.
Apache License 2.0
416 stars 219 forks source link

Hitbtc not disconnect properly #168

Open lijun003 opened 6 years ago

lijun003 commented 6 years ago

2018-04-20 13:32:12.828 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:12.928 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.031 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.135 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.238 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.337 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.422 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.542 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.627 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped. 2018-04-20 13:32:13.725 WARN 6128 --- [ntLoopGroup-4-2] i.b.x.hitbtc.HitbtcStreamingService : The message has been received from disconnected channel 'orderbook-BTCUSD'. Skipped.

pchertalev commented 6 years ago

How did u reporoduce this case? I tryed exchange.disconnect() and orderBookObserver.dispose(); - I don't see problem. There is known issue that netty thread can't be stopped after disconnect and java can't be shutdown, but this problem exists for all exchanges which use NettyStreamingService

garciapd commented 5 years ago

I see it just happening now, I sometimes disconnect on purpose from the exchange and after that i'm getting the mentioned error.

Looks like the connection is closed by Hitbtc, it is trying to reconnect and it does too many requests, but finally it gets connected again and at some point it gets another error, then i disconnect and form there i start getting the message (The message has been received from disconnected channel)

I saw these messages (and maybe are not all related to triggering the same issue but I write them just in case)

i.bitrich.xchangestream.service.netty.WebSocketClientHandler - WebSocket Client disconnected!
info.bitrich.xchangestream.hitbtc.HitbtcStreamingService - Reopening websocket because it was closed by the host
info.bitrich.xchangestream.hitbtc.HitbtcStreamingService - Connecting to wss://api.hitbtc.com/api/2/ws
i.bitrich.xchangestream.service.netty.WebSocketClientHandler - WebSocket Client connected!
info.bitrich.xchangestream.hitbtc.HitbtcStreamingService - Resubscribing channels
i.bitrich.xchangestream.service.netty.WebSocketClientHandler - WebSocket Client failed to connect. 

At some point I get some of that ones:
info.bitrich.xchangestream.hitbtc.HitbtcStreamingService - Problem with connection: class io.netty.handler.codec.http.websocketx.WebSocketHandshakeException - Invalid handshake response getStatus: 429 Too Many Requests

Finally I get:
Exception:java.lang.IllegalStateException: Accept exceeded fixed size of 78

Then I disconnect and start receiving the:
The message has been received from disconnected channel 'orderbook-DASHETH'.

Hope it helps to find the problem