Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions render_machine/render_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fcntl
import os
import signal
import subprocess
Expand All @@ -18,6 +19,8 @@
POLL_INTERVAL_SECONDS = 0.2
SIGTERM_GRACE_PERIOD_SECONDS = 0.2
STDOUT_READ_TIMEOUT_SECONDS = 5
F_SETPIPE_SIZE = 1031 # Linux-only constant
PIPE_SIZE_KB = 1024 # 1MB


def revert_changes_for_frid(render_context):
Expand Down Expand Up @@ -101,6 +104,10 @@ def execute_script( # noqa: C901
start_new_session=(sys.platform != "win32"),
)

if sys.platform == "linux":
# Set the pipe size to 1MB to avoid buffer overflows
fcntl.fcntl(proc.stdout.fileno(), F_SETPIPE_SIZE, PIPE_SIZE_KB * 1024) # 1MB

try:
while proc.poll() is None:
if time.time() - start_time >= script_timeout:
Expand Down
Loading