Resolve Large Payload Bottlenecks in Flask Development Server #8

Closed
opened 2025-04-09 05:00:47 -06:00 by nicole · 0 comments
Owner

Overview:

I have research and initial testing taking place to resolve issues with the Flask server not liking when I stream larger payloads from an agent.

Errors like the following occur when the server cannot keep up due to the development nature of Flask and how Eventlet should be able to patch it to resolve all of these issues in a drop-in nature.

AssertionError: write() before start_response
Agent connected: lab-desktop-02-bunny-lab-io-agent-0ca32567
[WS] Agent disconnected
10.0.0.128 - - [09/Apr/2025 04:42:57] "GET /socket.io/?transport=websocket&EIO=4&t=1744195377.686833 HTTP/1.1" 500 -
Error on request:
Traceback (most recent call last):
  File "F:\Borealis\Server\Lib\site-packages\werkzeug\serving.py", line 370, in run_wsgi
    execute(self.server.app)
  File "F:\Borealis\Server\Lib\site-packages\werkzeug\serving.py", line 336, in execute
    write(b"")
  File "F:\Borealis\Server\Lib\site-packages\werkzeug\serving.py", line 261, in write
    assert status_set is not None, "write() before start_response"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Impact:

This is preventing the agents from sending higher resolution streams, which is fine if you are not trying to capture an entire computer screen at a high framerate, but bad if you do want to do that. You can work around the issue by reducing the ingestion rate / framerate of the agent, but that would mean that the benefits from migrating to the new Canvas image rendering pipeline would be mostly pointless, which is why the Eventlet implementation needs to take place.

## Overview: I have research and initial testing taking place to resolve issues with the Flask server not liking when I stream larger payloads from an agent. Errors like the following occur when the server cannot keep up due to the development nature of Flask and how Eventlet should be able to patch it to resolve all of these issues in a drop-in nature. ``` AssertionError: write() before start_response Agent connected: lab-desktop-02-bunny-lab-io-agent-0ca32567 [WS] Agent disconnected 10.0.0.128 - - [09/Apr/2025 04:42:57] "GET /socket.io/?transport=websocket&EIO=4&t=1744195377.686833 HTTP/1.1" 500 - Error on request: Traceback (most recent call last): File "F:\Borealis\Server\Lib\site-packages\werkzeug\serving.py", line 370, in run_wsgi execute(self.server.app) File "F:\Borealis\Server\Lib\site-packages\werkzeug\serving.py", line 336, in execute write(b"") File "F:\Borealis\Server\Lib\site-packages\werkzeug\serving.py", line 261, in write assert status_set is not None, "write() before start_response" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` ## Impact: This is preventing the agents from sending higher resolution streams, which is fine if you are not trying to capture an entire computer screen at a high framerate, but bad if you do want to do that. You can work around the issue by reducing the ingestion rate / framerate of the agent, but that would mean that the benefits from migrating to the new Canvas image rendering pipeline would be mostly pointless, which is why the Eventlet implementation needs to take place.
nicole added the
Kind/Bug
Kind/Enhancement
Priority
Medium
labels 2025-04-09 05:00:47 -06:00
nicole self-assigned this 2025-04-09 05:00:47 -06:00
nicole added this to the Borealis - Feature Roadmap project 2025-05-16 14:41:57 -06:00
nicole moved this to Done in Borealis - Feature Roadmap on 2025-05-16 14:43:07 -06:00
Sign in to join this conversation.
No description provided.