fix(widget): clamp stale saved dims and survive OOM in chart rasterizer#39
Conversation
A second, distinct path to the "widget permanently stuck, new widget works" symptom: when onUpdate's launcher options come back 0 it falls back to the saved per-id dimensions (widget_<id>_width_px/height_px) used UNCLAMPED. An install upgraded from a build that stored the raw launcher size can carry an over-budget value there; Bitmap.createBitmap then throws OutOfMemoryError — which is an Error, not an Exception, so it escapes generateChartBitmap's catch (Exception) and crashes the in-process widget receiver on every update. - Clamp the saved-dims fallback through WidgetUtils.clampChartDimensions, so a stale huge value can no longer reach createBitmap. - Add a catch (OutOfMemoryError) to both widget bitmap rasterizers (renderSvgStringToBitmap, renderSvgToBitmap) so any unforeseen over-budget allocation degrades to null (placeholder / smaller render) instead of crashing. Distinct regime from the budget-rejection retry (other PR): that one is an IllegalArgumentException from updateAppWidget; this one is an OutOfMemoryError from createBitmap, which neither the existing catch nor the retry handles. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 37 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ 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 |
Problem
A second, distinct path to the same "widget permanently stuck, new widget works, app fails to
update on tap" report — separate from the budget-rejection retry in #38.
When
onUpdateis triggered by a self-broadcast, the launcher options can come back as 0, so itfalls back to the saved per-id dimensions (
widget_<id>_width_px/height_px) — and uses themunclamped:
An install upgraded from a build that stored the raw launcher size can carry an over-budget value
here. Bitmap.createBitmap then throws OutOfMemoryError — which is an Error, not an Exception — so
it escapes generateChartBitmap's catch (Exception) and crashes the in-process widget receiver on
every update (and the app when it triggers a refresh on tap), freezing that widget until it's
re-created.
This regime is invisible to #38's retry, which only catches Exception (the budget rejection's
IllegalArgumentException). The two are different failure points: #38 = IllegalArgumentException
from updateAppWidget; this = OutOfMemoryError from createBitmap.
Fix
value can no longer reach createBitmap.
renderSvgToBitmap) so any unforeseen over-budget allocation degrades to null (placeholder /
smaller render via fix(widget): recover from launcher bitmap-budget rejection instead of freezing #38's retry) instead of crashing.
Defense in depth: the clamp removes the cause; the OOM catch ensures graceful degradation even if
a large allocation ever slips through.
Verification
unrelated to this change.