Skip to content

Commit 1ad8ff3

Browse files
author
Your Name
committed
Increasing pipe buffer size for non win32 machines
1 parent c28e57c commit 1ad8ff3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

render_machine/render_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import fcntl
12
import os
23
import signal
34
import subprocess
@@ -18,6 +19,7 @@
1819
POLL_INTERVAL_SECONDS = 0.2
1920
SIGTERM_GRACE_PERIOD_SECONDS = 0.2
2021
STDOUT_READ_TIMEOUT_SECONDS = 5
22+
F_SETPIPE_SZ = 1031 # Linux-only constant
2123

2224

2325
def revert_changes_for_frid(render_context):
@@ -101,6 +103,10 @@ def execute_script( # noqa: C901
101103
start_new_session=(sys.platform != "win32"),
102104
)
103105

106+
if sys.platform != "win32":
107+
# Set the pipe size to 1MB to avoid buffer overflows
108+
fcntl.fcntl(proc.stdout.fileno(), F_SETPIPE_SZ, 1024 * 1024) # 1MB
109+
104110
try:
105111
while proc.poll() is None:
106112
if time.time() - start_time >= script_timeout:

0 commit comments

Comments
 (0)