Socket circular reference in CherryPy server?

Open
#258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the issue with the CherryPy server: repeatedly refresh a websocket page, inspect the garbage collector's SSLSocket objects, and observe whether sockets remain until a full sweep. Compare this with the reported cheroot workaround of collecting after accept() raises OSError. Done means identifying and preventing the retained connection objects from exhausting file descriptors.

Written by the indexing model from the issue text.

Description

With the CherryPy server, if you repeatedly refresh a page with websockets, then iterate the gc module's list of objects for SSLSockets, you might find an extra object for every connection.

These are collected at the next "full" sweep, but if that does not happen, eventually an OSError will occur from too many open files(On Linux).

As a workaround, I patched my copy of cheroot to do GC when accept() raises OSError.

I have heard that in the past inspecting stack frames can do odd things on very old version of python. I wonder some remnant of that bug could be related to this?

Dominant language
Python
Stars
1.1k
Forks
285
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from Lawouach/WebSocket-for-Python

All issues in Lawouach/WebSocket-for-Python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.