feat(servo): add poisoning mechanism for repeated render panics#379
feat(servo): add poisoning mechanism for repeated render panics#379streamer45 merged 1 commit intomainfrom
Conversation
After POISON_THRESHOLD (5) consecutive render panics, mark the instance as poisoned. Poisoned instances skip Servo calls entirely and return the cached frame until a URL change (UpdateConfig) resets the state. - Add consecutive_panic_count and poisoned fields to InstanceState - Check poison state before Render catch_unwind; skip to fallback - Increment counter on panic; mark poisoned at threshold with tracing::error! - Reset counter to 0 on successful render - Reset poison state + counter on URL change with tracing::info! - Update module doc to describe the poisoning hardening Closes #348 Closes #347 Signed-off-by: StreamKit Devin <devin@streamkit.dev> Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
|
✅ Reviewed on |
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
ReviewOverall: Good design. The poisoning mechanism is well-scoped — per-instance tracking, threshold-based, auto-reset on URL change. Must fix before merge
Should address (or file tracking issue)
Design questions (non-blocking)
|
Summary
Adds a poisoning mechanism to the Servo plugin's shared renderer thread to protect against instances that repeatedly panic during rendering.
After
POISON_THRESHOLD(5) consecutive render panics, an instance is marked as poisoned: Servo calls are skipped entirely and the cached frame is returned. This prevents a single broken page from repeatedly triggering panics that consume resources on the shared thread.Changes (
servo_thread.rs)POISON_THRESHOLDconstant (5) — configurable threshold for consecutive panics.consecutive_panic_count/poisonedfields onInstanceState— per-instance tracking.send_fallback_framebeforecatch_unwind. On panic, the counter increments; at threshold,tracing::error!is emitted and the instance is poisoned. On success, the counter resets to 0.poisonedandconsecutive_panic_countwithtracing::info!, giving the instance a fresh start with the new page.Config tests (#347)
All requested config validation and runtime update logic tests already exist on
maininconfig.rs(34 tests coveringvalidate(),parse_resolution(),merge_update(),effective_viewport_width/height(),needs_scaling()). They all pass with this change.Review & Testing Checklist for Human
Rendermatch arm: counter increments on panic, resets on success, poisons at thresholdUpdateConfigpoison reset only triggers on actual URL changes (not CSS-only updates)POISON_THRESHOLD = 5is a reasonable default for your use caseNotes
just testplugin integration tests (plugin_integration_test.rs) have pre-existing failures unrelated to this change (HTTP 422 assertions). The servo plugin's own 34 unit tests all pass.Link to Devin session: https://staging.itsdev.in/sessions/712b2767284e427a8dc6544eafeb87ef
Requested by: @streamer45