Skip to content
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

Fix and Add Logging for StateMachine websocket close #537

Merged

Conversation

shaydewael
Copy link
Contributor

@shaydewael shaydewael commented Apr 19, 2018

Summary

Addresses #531 and #527. Adds flags to KeepAlive and logs in client on unexpected websocket close during handshaking state. Also addresses race condition that could cause this unexpected close.

Requirements (place an x in each [ ])

@codecov
Copy link

codecov bot commented Apr 19, 2018

Codecov Report

Merging #537 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #537   +/-   ##
=======================================
  Coverage   80.28%   80.28%           
=======================================
  Files           6        6           
  Lines         279      279           
  Branches       43       43           
=======================================
  Hits          224      224           
  Misses         38       38           
  Partials       17       17

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 017ef50...2c21341. Read the comment docs.

this.logger.debug(`disconnected after unexpected close ${context.eventPayload.reason}
${context.eventPayload.code} with isMonitoring set to ${this.keepAlive.isMonitoring}
and recommendReconnect set to ${this.keepAlive.recommendReconnect}`);
// this transition circumvents the 'disconnecting' state (since the websocket is already closed),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ the attention to detail in the comments!

@aoberoi
Copy link
Contributor

aoberoi commented Apr 19, 2018

@shanedewael i know there's no testing rig for RTMClient at the moment, but it would be useful to know if you're done manual testing, and what that manual testing code might have looked like.

@shaydewael
Copy link
Contributor Author

@aoberoi I manually hacked together a way to reproduce the bugs by emitting a handshake event in RTMClient.ts, listening to that event, and then forcibly closing the websocket in that state. This let me develop a solution to handle the error, and then by thinking through race conditions in KeepAlive.ts, prevent it from happening in the first place.

@shaydewael shaydewael merged commit 7cef7ec into slackapi:master Apr 19, 2018
@vleipnik
Copy link

vleipnik commented May 2, 2018

Guys, I am still getting an error with 4.2.0:

screen shot 2018-05-02 at 11 10 39 am

This seems related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants