-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[streaming] ping related cleanup, inspection cleanup #3533
Conversation
@earce In my case, I can't tolerate the connection going down, and simply reconnecting, as I may miss updates, I need to clear my caches as soon as this is detected (and rebuild them after a fresh connect). There are a couple PR from the old project I still need to bring over for this (I can only do one at a time) |
@mdvx I ran several tests with the iteration of the code in this review and never saw a disconnect. Are the PRs you are referring to related to the issues with Kraken connectivity? |
No, not Kraken Specifically (but I can;t remember what prompted the changes). I have migrated them to this new PR now #3534 |
@mdvx are you comfortable with these changes, as they overlap with yours? Are you aware that there is no way to either ensure the connection stays up or to detect if it drops 100% reliably? It's just not a feature of TCP. I'm currently working on a background PR to add something I use in my app to the library: a wrapper for |
@@ -57,6 +54,9 @@ protected void handleMessage(JsonNode message) { | |||
KrakenEventType krakenEvent; | |||
if (event != null && (krakenEvent = KrakenEventType.getEvent(event.textValue())) != null) { | |||
switch (krakenEvent) { | |||
case pingStatus: | |||
LOG.warn("PingStatus received: {}", message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warn is quite high. Does this warrant waking someone up for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to info
@@ -163,8 +163,7 @@ protected Completable openConnection() { | |||
if (ssl) { | |||
SslContextBuilder sslContextBuilder = SslContextBuilder.forClient(); | |||
if (acceptAllCertificates) { | |||
sslContextBuilder = | |||
sslContextBuilder.trustManager(InsecureTrustManagerFactory.INSTANCE); | |||
sslContextBuilder.trustManager(InsecureTrustManagerFactory.INSTANCE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the fmt plugin needs rerunning here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reran (nothing changed here but gemini streaming service did)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of questions/spots
@badgerwithagun yes typically with failed writes and timeouts, and this can be tougher to do depending on why the socket connection was broken. Yes I'd be curious to see how you are combining polling and streaming. To your point of resyncing streams, are do you mean adding in polling to reconcile missed data or something else all together? Yes I would be curious to see this PR. @mdvx let me know if there is anything with this review that you need changed. Also tangential but I know probably due to the ongoing crisis affecting every one the cadence of these releases has changed but does the project have an idea when 5.0.0 may be cut? |
It was disconnecting within the minute, every minute. |
I didn't see any disconnects after running with this implementation for some time. |
We are all a bit out of sync, when I added the onIdle ctx write ping frame, the pingStatus message did not exist, it is possible we are doubling up now. I am installing the PR as it stands, with my other PRs and checking Gemini works |
I see no problems with this implementation :-) @earce @badgerwithagun |
Right now, I can't implement
because Gemini is using instead of a single GeminiProductStreamingService any thoughts? |
I'm merging this for now. Can we move your question to a separate issue, please, @mdvx? I do think the |
Cleaning up some redundant parts of the code related to ping.
Log + Gemini both override method
protected void handleIdle(ChannelHandlerContext ctx)
which is now part ofNettyStreamingService.java
behavior so have removed these overrides. Since Gemini's idle time was 15 seconds which is Netty's default --have switched to use that default var.In my QA environment I saw bitrich-info/xchange-stream#502 present itself and
pingStatus
treated as an unknown message type which I have now added to the switch to log as awarn
given this presents itself when we are hitting rate limits. Not sure if another log level makes more sense? Additionally, is this issue only a product of attempting to open many WebSocket connections quickly, or can it occur by hammering a single WebSocket channel with 15+ subscriptions?Have removed
protected Completable openConnection()
override fromKrakenStreamingService.java
given that the idle ping sends a ping out every 15 seconds of being idle (this will now be a web socket ping rather then an application level ping). @mdvx I saw you had added this in, with what frequency were you seeing disconnects? Was the heartbeat not sufficient to keep the connection alive?In
NettyStreamingService.java
have cleared up some inspection warnings.