Skip to content

Ignore websockets error code 1006#1649

Merged
dadjeibaah merged 3 commits intomasterfrom
dad/websocket-error-part2
Sep 17, 2018
Merged

Ignore websockets error code 1006#1649
dadjeibaah merged 3 commits intomasterfrom
dad/websocket-error-part2

Conversation

@dadjeibaah
Copy link
Contributor

When a websocket connection is closed between Chrome and a server, we get a 1006 error code signifying abnormal closure of the websocket connection. It seems as if we only get this error on Chrome web clients. Firefox and Safari do not encounter this issue.

The solution is to suppress 1006 errors that occur in the web browser since the connection is closed anyway. There is no negative side effect that occurs when the connection is closed abnormally and so the error message is benign.

tap-output

fixes #1630

Signed-off-by: Dennis Adjei-Baah [email protected]

@dadjeibaah dadjeibaah self-assigned this Sep 14, 2018
@dadjeibaah dadjeibaah changed the title Ignore websockets errors of code 1006 Ignore websockets error code 1006 Sep 14, 2018
Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

looks good, one tioli comment...

this.setState({
tapRequestInProgress: false
tapRequestInProgress: false,
tapIsClosing: false
Copy link
Member

Choose a reason for hiding this comment

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

in most places, we're updating tapRequestInProgress and tapIsClosing together. would these two booleans make more sense / be simpler as a 3-state enum (ready, inprogress, closing)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. I will add that in the next commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that I think of it, I think it may be best to leave this as it is and create a new ticket that will address this issue and other refactor tasks that need to be done in the TopModule.

Copy link

@rmars rmars left a comment

Choose a reason for hiding this comment

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

nice! disabling of the Stop button seems like a very user friendly addition

this.stopTapStreaming();

if (!e.wasClean) {
if (!e.wasClean && e.code !== 1006) {
Copy link

Choose a reason for hiding this comment

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

can we leave a comment here explaining why we're ignoring this? (maybe a link to the ticket would be helpful)

resourcesByNs={this.state.resourcesByNs}
authoritiesByNs={this.state.authoritiesByNs}
tapRequestInProgress={this.state.tapRequestInProgress}
tapIsClosing={this.state.tapIsClosing}
Copy link

Choose a reason for hiding this comment

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

we'll need to set a default value for this state otherwise we get a console error on the Top page:

warning.js:33 Warning: Failed prop type: The prop `tapIsClosing` is marked as required in `TapQueryForm`, but its value is `undefined`.
    in TapQueryForm (created by AddUrlProps(TapQueryForm))
    in AddUrlProps(TapQueryForm) (at Top.jsx:158)
    in div (at Top.jsx:155)
    in Top (at AppContext.jsx:10)
    in Unknown (created by Route)
    in Route (at index.js:56)
    in Switch (at index.js:47)
    in div (at index.js:46)
    in div (created by Basic)
    in Basic (created by Adapter)
    in Adapter (at index.js:45)
    in div (created by BasicLayout)
    in BasicLayout (created by Adapter)
    in Adapter (at index.js:43)
    in div (created by BasicLayout)
    in BasicLayout (created by Adapter)
    in Adapter (at index.js:41)
    in RouterToUrlQuery (at index.js:40)
    in Router (created by BrowserRouter)

startTap: PropTypes.bool.isRequired,
updateNeighbors: PropTypes.func
updateNeighbors: PropTypes.func,
updateTapClosingState: PropTypes.func.isRequired
Copy link

Choose a reason for hiding this comment

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

I think this prop should be not required, with a default value of _.noop. The resource detail pages use the Top module, but don't use a form, so we don't need to update the form stop button in this case.

When switching from a ResourceDetail page to another page, we get a console error because that page doesn't set the updateTapClosingState function

Warning: Failed prop type: The prop `updateTapClosingState` is marked as required in `TopModule`, but its value is `undefined`.
    in TopModule (at AppContext.jsx:10)
    in Unknown (at ResourceDetail.jsx:218)
    in div (at ResourceDetail.jsx:217)
    in div (at ResourceDetail.jsx:197)
    in div (at ResourceDetail.jsx:265)
    in div (at ResourceDetail.jsx:264)
    in ResourceDetailBase (at AppContext.jsx:10)
    in Unknown (created by Route)
    in Route (at index.js:53)
    in Switch (at index.js:47)
    in div (at index.js:46)
    in div (created by Basic)
    in Basic (created by Adapter)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch!

@siggy siggy added the area/web label Sep 17, 2018
Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

@rmars rmars left a comment

Choose a reason for hiding this comment

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

🐎 🐰 nice!!!

@dadjeibaah dadjeibaah merged commit 9951a6e into master Sep 17, 2018
@dadjeibaah dadjeibaah deleted the dad/websocket-error-part2 branch September 17, 2018 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI always receives a websocket 1006 error after tap/top stops streaming.

3 participants