fix: guard the dashboard's docker icon onerror fallback - #2709
Conversation
The dashboard renders each container icon with an onerror handler that falls back to question.png, but for containers without an icon the src is already question.png. When that file goes missing the handler just reassigns the same dead URL, so the browser retries it forever. I hit this on my own server after the icon disappeared: 18,322 requests for the fallback in two minutes from a single open dashboard, against 5 for the initial src. DockerContainers.php got this exact guard in unraid#2693. The dashboard copy of the same line was missed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe Docker image fallback handler now clears ChangesDocker image fallback
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #2693, which added this guard to
DockerContainers.phpbut not to the dashboard's copy of the same line inDashboardApps.php.The dashboard renders every container icon like this:
For a container with no icon,
$info['icon']is already the question.png path (set inDockerClient.php:346), sosrcand theonerrortarget are the same file. If question.png is missing, the handler reassigns a URL that also 404s, which firesonerroragain, and nothing ever detaches it.I ran into this after question.png was deleted on my server — the bug fixed in #2693. I'm on 7.3.2, so the backport in #2708 hasn't reached me yet. nginx's error log for the two minutes I had the dashboard open:
The
?is empty becausefilemtime()returns false for the missing file, which is what makes the two URLs distinguishable in the log. That 5 : 18,322 split is the retry loop — polling would keep the two roughly proportional.The change is the same one already merged for
DockerContainers.php: quote the attribute and setthis.onerror=nullbefore reassigningsrc. Theonerrorfragment is now byte-identical between the two files. A missing fallback then costs one extra failed request per image instead of an unbounded loop.Containers with a working icon are unaffected, and one whose icon 404s still falls back to question.png and renders it. Only the pathological case is capped.
Testing
DashboardApps.phpis byte-identical between 7.3.2 and master atd3898259, so I tested the patched master file on a 7.3.2 box.php -lclean. Rendered the expression with the file missing, before and after:I also confirmed the underlying deletion end-to-end on 7.3.2 before patching: with a throwaway icon-less container registered in docker.json, removing it from the Docker tab (
Events.php→removeContainer()withcache=1) deleted question.png at the moment of the click, which inotify caught. That part is already handled by #2693/#2708 — this PR only caps the fallout when the file is missing for any reason.🤖 Generated with Claude Code
Summary by CodeRabbit