Skip to content

Remove redundant chmod -R on /tmp + avoid body buffering for response size#854

Open
urbantech wants to merge 1 commit intogarrytan:mainfrom
urbantech:fix/709-711-docker-and-perf
Open

Remove redundant chmod -R on /tmp + avoid body buffering for response size#854
urbantech wants to merge 1 commit intogarrytan:mainfrom
urbantech:fix/709-711-docker-and-perf

Conversation

@urbantech
Copy link
Copy Markdown

Summary

#709 — Docker: chmod -R 1777 /tmp sets sticky bit on files

Line 61 of Dockerfile.ci correctly does chmod 1777 /tmp. Line 63 redundantly does chmod -R 1777 /tmp, recursively applying the sticky bit to all files inside /tmp (meaningless on Linux files, confusing).

Fix: Remove the redundant line 63.

#711 — Performance: res.body() buffers entire response for size

The requestfinished handler called await res.body() on every completed request to measure body.length. For large assets (videos, images, downloads), this buffers the entire response into memory unnecessarily.

Fix: Read content-length header instead — zero memory allocation, same metric quality. Falls back to 0 for chunked/missing headers (acceptable for a size metric).

Test Plan

  • browser-manager unit tests pass (2/2)
  • Dockerfile syntax verified

Fixes #709, fixes #711

Dockerfile.ci (garrytan#709):
Line 63 'chmod -R 1777 /tmp' redundantly applied sticky bit to all
files inside /tmp (not just the directory). Line 61 already correctly
sets 'chmod 1777 /tmp'. Remove the duplicate -R variant.

browser-manager.ts (garrytan#711):
requestfinished handler called res.body() to measure response size,
buffering entire responses (videos, images, downloads) into memory.
Replace with content-length header read — zero memory allocation,
same metric quality (falls back to 0 for chunked/missing header).

Fixes garrytan#709, fixes garrytan#711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance: res.body() buffers entire response for size calculation Docker: chmod -R 1777 /tmp sets sticky bit on files

1 participant