I was asked to give this a quick look; do you have a reproducer that
demonstrates the problem?

It looks to me like the bounded Queue implementation tries hard to push
back against unconstrained resource growth:

    def put(
        [ ... ]
        future = Future()  # type: Future[None]
        try:
            self.put_nowait(item)
        except QueueFull:
            self._putters.append((item, future))
            _set_timeout(future, timeout)
        else:
            future.set_result(None)
        return future

    def put_nowait(self, item: _T) -> None:
        [ ... ]
        self._consume_expired()
        if self._getters:
            assert self.empty(), "queue non-empty, why are getters waiting?"
            getter = self._getters.popleft()
            self.__put_internal(item)
            future_set_result_unless_cancelled(getter, self._get())
        elif self.full():
            raise QueueFull
        else:
            self.__put_internal(item)

    def full(self) -> bool:
        if self.maxsize == 0:
            return False
        else:
            return self.qsize() >= self.maxsize


Taken together, these look to me like they should raise an error if the Queue 
is already full, place the requestor on the _putters list, and keep going.

It's a guess, but I'd hope the size of the _putters list is constrained
by per-process open file limits -- eg I'm hoping every _putter
represents a socket, and those are usually constrained to 1024 per
process, or 10k per process, etc.

Thanks

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1903733

Title:
  Out of memory issue for websocket client

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-tornado/+bug/1903733/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to