tornadoweb / tornadoweb/tornado

WebSocketProtocol13.periodic_ping exception

Open
#2,136 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

websocket windows
Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

Description

We are running a Tornado TCP server on a Windows server 2012 machine. This machine handles both an HTTP-based dashboard and 21 TCP Websocket connected clients. Occasionally in the logs we will see the following error. It seems to be at a very low level of the Websocket13 protocol. But from a networking standpoint what does it mean? Why would the write buffer not be greater than or equal to 0?

[ERROR] [2017-08-17 11:54:14 AM] [tornado.application] Exception in callback <bound method WebSocketProtocol13.periodic_ping of <tornado.websocket.WebSocketProtocol13 object at 0x01D7AD30>>

Traceback (most recent call last):

File "C:\Python27\lib\site-packages\tornado\ioloop.py", line 1026, in _run

    return self.callback()

File "C:\Python27\lib\site-packages\tornado\websocket.py", line 1030, in periodic_ping

    self.write_ping(b'')

File "C:\Python27\lib\site-packages\tornado\websocket.py", line 790, in write_ping

    self._write_frame(True, 0x9, data)

File "C:\Python27\lib\site-packages\tornado\websocket.py", line 768, in _write_frame

    return self.stream.write(frame)

File "C:\Python27\lib\site-packages\tornado\iostream.py", line 406, in write

    self._handle_write()

File "C:\Python27\lib\site-packages\tornado\iostream.py", line 847, in _handle_write

    assert self._write_buffer_size >= 0

AssertionError

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the traceback locations in tornado/websocket.py, especially WebSocketProtocol13.periodic_ping and _write_frame, then follow the write path into tornado/iostream.py and _handle_write. Reproduce or trace the Windows server scenario to determine why _write_buffer_size becomes negative, and consider the issue resolved when the cause and an appropriate fix are verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.