Repository navigation
fix(xhgui): raise upload limits to 100M so large profiles import, fixes #9025 - #9027
Conversation
|
Pushed updated container image(s) for this PR:
|
|
Download this PR's build for your OS and architecture with: ddev utility download-ddev --pr 9027Or download the artifact for your OS and architecture directly:
See Testing a PR. |
stasadev
left a comment
There was a problem hiding this comment.
The 10.8MB profile from the issue imports now, but bigger ones hit the PHP memory_limit=512M in the same Dockerfile. Claude Code ran real profiles on Docker 29:
| Profile | v1.25.5 | This PR |
|---|---|---|
| 13.2MB | 413 | imported |
| 18.4MB | 413 | 500, Allowed memory size of 536870912 bytes exhausted ... NormalizingSaver.php on line 35 |
XHGui needs about 30-35x the profile size in memory, so 100M would need around 3G. With 640M the 18.4MB profile imports. The 500 is worse than the old 413, because the profiler only falls back to /tmp/xhgui.data.jsonl when the upload fails, and here XHGui accepts the body and then dies.
Maybe raise the memory limit too? It is only a local tool:
RUN echo 'memory_limit=-1' >> $PHP_INI_DIR/conf.d/99-memory-limit.iniOr keep 512M and change "up to 100MB" in the description to about 15MB.
Small things:
- The 18.4MB import takes 1.3-2.4s here, and the collector uploads with
'timeout' => 3. On slower machines this will be the next limit. Can be a follow-up. - With 80,000 generated functions, Claude Code got a 4.7MB profile, which also imports on v1.25.5. The test needs something above 5MB to show the difference.
🤖 Reviewed with assistance from Claude Code
|
Thanks, updated. Went with memory_limit=-1 |
stasadev
left a comment
There was a problem hiding this comment.
Thanks, works now. Claude Code applied the new memory_limit=-1 and 'timeout' => 30 by hand to the previous PR images, because the new ones were not pushed yet:
| Profile | Result | xhgui peak memory |
|---|---|---|
| 18MB | imported | 634M |
| 30MB | imported | 1.1G |
| 42MB | imported | 1.9G |
The 42MB import takes 3.5-4.3s, so the old 3s timeout would also fail here.
About memory_limit=512M: there was no deeper reason for it. It came from the add-on in ddev/ddev-xhgui#4 (Nov 2023), which raised it from PHP's default 128M because "I fairly easily hit the 128MB limit profiling a real site". client_max_body_size 5M came from the upstream XHGui nginx.conf. #7069 copied both from the add-on into the core image as they were. So removing the limit is fine.
🤖 Reviewed with assistance from Claude Code
|
Pushed updated container image(s) for this PR:
|
ddev#9025 XHGui now imports xhprof profiles up to 100MB. Before, nginx rejected any profile over 5MB with a 413, and the run never appeared. - Fixes ddev#9025 The `ddev-xhgui` image raises `client_max_body_size` in nginx and `post_max_size` in PHP to 100M. Both limits must change, because PHP rejects a body over its default 8M after nginx accepts it. ```bash ddev utility download-ddev --pr 9027 export PATH="$HOME/tmp/ddev-download-ddev/pr-9027:$PATH" ddev config --project-type=php ddev start ddev xhgui on ddev exec 'head -c 11000000 /dev/zero | tr "\0" a > /tmp/big.json' ddev exec 'curl -s -w "\n%{http_code}\n" -X POST -H "Content-Type: application/json" --data-binary @/tmp/big.json http://xhgui/run/import' ``` For a real profile, profile a page that calls many distinct functions, for example 80,000 generated functions. The profile is about 6.6MB, and it appears in `ddev xhgui`. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…out to 30s XHGui needs about 30-35 times the profile size in memory, so an 18MB profile failed with a 500 at memory_limit=512M. XHGui is a local tool, so memory_limit=-1 removes the limit. The collector's 3s upload timeout was close to the 1.3-2.4s that an 18MB import takes. The collector now waits up to 30s before it falls back to /tmp/xhgui.data.jsonl. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… buildkite] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UrTUMzL13VnrzgmdLVPKU1
b0f7bf9 to
fcc243f
Compare
|
Pushed updated container image(s) for this PR:
|
Short Summary (TL;DR)
XHGui now imports xhprof profiles up to 100MB. Before, nginx rejected any profile over 5MB with a 413, and the run never appeared.
The Issue
xhgui/xhguiimageHow This PR Solves The Issue
The
ddev-xhguiimage raisesclient_max_body_sizein nginx andpost_max_sizein PHP to 100M. Both limits must change, because PHP rejects a body over its default 8M after nginx accepts it.XHGui needs about 30-35 times the profile size in memory, so the image also sets
memory_limit=-1. The webserver's XHGui collector waits up to 30s for the upload instead of 3s, because an 18MB profile takes about 2s to import.Manual Testing Instructions
For a real profile, profile a page that calls many distinct functions, for example 120,000 generated functions, so the profile is over 5MB. The profile appears in
ddev xhgui.🤖 Developed with assistance from Claude Code