question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Random disconnects on websocket

See original GitHub issue

Our app is using Vertx 3.5.0 with netty 4.0.15. Often, we see websockets disconnect randomly. There were no exceptions thrown at the time of disconnect, but we see a consistent pattern in how it happens. I enabled debug logging on one of the servers and were able to capture the events during disconnect.

Here is a sequence:

2018-04-13 13:58:31.701 | DEBUG | LoggingHandler | vert.x-eventloop-thread-3 | [id: 0x6b76bf39, L:/<Server>:51382 - R:<Remote>:443] READ: 1357B 2018-04-13 13:58:31.701 | DEBUG | WebSocket08FrameDecoder | vert.x-eventloop-thread-3 | Decoding WebSocket Frame opCode=1 2018-04-13 13:58:31.701 | DEBUG | WebSocket08FrameDecoder | vert.x-eventloop-thread-3 | Decoding WebSocket Frame length=1019 2018-04-13 13:58:31.701 | DEBUG | WebSocket08FrameDecoder | vert.x-eventloop-thread-3 | Decoding WebSocket Frame opCode=0 2018-04-13 13:58:31.701 | DEBUG | WebSocket08FrameDecoder | vert.x-eventloop-thread-3 | Decoding WebSocket Frame length=7 2018-04-13 13:58:31.701 | DEBUG | LoggingHandler | vert.x-eventloop-thread-3 | [id: 0x6b76bf39, L:/<Server>:51382 - R:<Remote>:443] CLOSE 2018-04-13 13:58:31.705 | DEBUG | LoggingHandler | vert.x-eventloop-thread-3 | [id: 0x6b76bf39, L:/<Server>:51382 ! R:<Remote>:443] READ COMPLETE 2018-04-13 13:58:31.705 | DEBUG | LoggingHandler | vert.x-eventloop-thread-3 | [id: 0x6b76bf39, L:/<Server>:51382 ! R:<Remote>:443] USER_EVENT: SslCloseCompletionEvent(java.nio.channels.ClosedChannelException) 2018-04-13 13:58:31.705 | DEBUG | LoggingHandler | vert.x-eventloop-thread-3 | [id: 0x6b76bf39, L:/<Server>:51382 ! R:<Remote>:443] INACTIVE 2018-04-13 13:58:31.705 | DEBUG | LoggingHandler | vert.x-eventloop-thread-3 | [id: 0x6b76bf39, L:/<Server>:51382 ! R:<Remote>:443] UNREGISTERED

We don’t see an opCode (8) to indicate a close, yet we see a CLOSE event after processing a ‘continue frame’ (opCode=0)

This pattern of close followed by a continuous frame has been consistent in all the disconnects we have seen so far. Since there are no exceptions seen in the log, it was not clear what the exact reason for the close, or who initiated it.

Can you please help understand a probable cause for the CLOSE? Is there anything in addition to enabling debug logging that we can do to get more information regarding this close? I have looked in code, but was difficult to figure the flow.

Expected behavior

Websocket should not be closed

Actual behavior

WebSocket closes with a CLOSE event

Steps to reproduce

Happens randomly, and were not successful at reproducing.

Minimal yet complete reproducer code (or URL to code)

Netty version

4.0.15

JVM version (e.g. java -version)

Java 8

OS version (e.g. uname -a)

Linux 2.6.32-573.26.1.el6.x86_64 CentOS 6.7

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pvubcommented, May 9, 2018

@normanmaurer Unfortunately Vert.x 3.5.1 doesn’t include support for ‘permessage-deflate’ compression. My App was built off a branch off 3.5.0 with support for pm-deflate. I’ll have to try porting that change over to 3.5.1. I’ll try upgrading.

0reactions
normanmaurercommented, Sep 3, 2018

I will close this for now… Please re-open if you think there is a netty issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Websockets disconnecting at random intervals #244 - GitHub
I am starting to suspect it is an issue with the Node Cluster not having sticky sessions and thus breaking the protocol as...
Read more >
WebSocket Disconnects - PTC Support
WebSocket disconnects can happen by choice, or due to exceptional/error conditions. Here is some information about what happens in each case:.
Read more >
Node.js "ws" websocket server randomly disconnects client after
Node.js "ws" websocket server randomly disconnects client after ~30 seconds, error 1006 ; WebSocket = require('ws'); ; path: "/ws" }); wss.on ; log(" ......
Read more >
Intermittent WebSocket Disconnects in Composer
When experiencing intermittent or frequent WebSocket disconnects in Composer, check for the following: What version of Composer you are using?
Read more >
Random disconnects, Websocket confused - developers & users
Any update on this? We too are seeing random disconnects, even without load – just a few people. Our case may be different....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found