[GH-ISSUE #4696] [Issue]: Responsiveness degrades over long sessions until refresh #2573

Closed
opened 2026-10-21 05:50:26 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Aug 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4696

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Marinara Engine becomes progressively less responsive during a long session, even when no response is being generated. A refresh restores normal performance. Opening and scrolling through a large image Gallery appears to accelerate the degradation, although the supplied Firefox recording indicates that the problem is broader than the Gallery alone.

Expected behavior

Marinara Engine should maintain stable input, scrolling, hover, and navigation responsiveness over a long session. Closing a large Gallery should stop its active work and allow image/DOM resources to be reclaimed without requiring a page refresh.

Actual behavior

Responsiveness gradually degrades the longer the application remains open. UI interactions become visibly laggy and main-thread stalls occur while no model generation is active. Refreshing the page immediately restores normal responsiveness.

The supplied Firefox performance recording indicates two likely compounding sources:

  1. Animated accent updates modify root-level CSS variables every 500 ms. One tick causes color and border transitions across hundreds of mounted controls, producing a large transition/event/task storm.
  2. Gallery grids render original full-resolution image URLs. Images are lazy-loaded and asynchronously decoded, but the grid is not virtualized and there is no thumbnail endpoint. After scrolling through a large Gallery, Firefox may retain many decoded originals after the Gallery closes.

The Gallery drawer itself appears to unmount correctly and cleans up its document pointer listener, so this should not initially be treated as a proven detached React-subtree leak.

Steps to reproduce

  1. Launch Marinara Engine in Firefox and use Roleplay mode for an extended session.
  2. Open a Gallery containing many images and scroll through enough of it to load a substantial number of thumbnails.
  3. Close the Gallery and continue navigating, scrolling, typing, and hovering in Marinara Engine without generating a response.
  4. Observe that general UI responsiveness becomes progressively worse.
  5. Refresh the page.
  6. Observe that normal responsiveness returns immediately.

A useful comparison is to repeat the same session with RGB Accent, Accent Pulse, custom-theme accent pulse, and Custom Cursor disabled, with Reduce ambient animations and effects enabled.

Environment

  • Marinara Engine version: Not captured in the report; the profile contains React development-build frames
  • Install type: Source/development build (inferred from the supplied profiler recording)
  • OS + version: macOS 26.5.2, Apple silicon
  • Browser or app shell: Firefox 153 / Cocoa (profile build ID 20260803132010)

Logs, screenshots, or video

Firefox performance recording: Firefox 2026-08-06 23.40 profile.json.gz

The approximately 26.2-second recording was captured while no response was being generated. Notable observations:

  • 36,109 CSS-transition markers, approximately 694 transitions per 500 ms accent tick
  • 221,013 DOM-event markers
  • 215,106 scheduled-task markers
  • Dominant transition events: approximately 72k transitionrun, 72k transitionstart, and 68k transitionend
  • Dominant transitioned properties: color, scrollbar-color, and individual border colors
  • Main-thread long tasks reached approximately 2.2 seconds; sampled event delay reached approximately 2.5 seconds
  • The Marinara content-process malloc counter rose from a post-collection low around 1.24 GB to approximately 1.47 GB by the end of the recording
  • Hot JavaScript stacks include queueAccentAnimationTick → applyLiveAccent, React mutation/passive/layout effect traversal, Roleplay surface updates, and custom-cursor color resolution
  • The closed Gallery did not appear as active React component work in the sampled timing data
  • Firefox Inspector/Compatibility tooling and the React development build amplified the absolute cost, but the recurring root-variable/transition storm originates in application behavior

The malloc counter is not a heap snapshot, so its growth does not by itself prove a reachable-object leak. A production-build recording and before/after heap or about:memory comparison would help distinguish decoded-image caching from retained application objects.

Additional context

Relevant implementation observations:

  • The chat Gallery is conditionally mounted and its document event listener has an effect cleanup.
  • Gallery rows map the complete image collection and use original /api/.../gallery/file/... resources as visual thumbnails. The server returns the stored original file without resizing.
  • React Query retains Gallery metadata temporarily after unmount, but that metadata is lightweight and does not contain the decoded bitmap data.
  • Animated accents update root foreground/chrome variables every 500 ms. Many shared controls transition color and border properties based on those variables.
  • Custom Cursor color resolution performs a synchronous computed-style read in the recurring accent path.

Suggested optimization boundary:

  • Prevent animated accent ticks from starting transitions across the entire mounted interface; isolate animated visuals or otherwise keep inherited control colors stable.
  • Remove synchronous computed-style work from recurring cursor recoloring.
  • Bound Gallery DOM and decoded-image cost through real thumbnails, responsive image sources, or simple virtualization/windowing.
  • Verify that closing Gallery/lightbox surfaces releases listeners and mounted nodes.
  • Compare a production build with DevTools closed before and after the optimization.

Acceptance criteria:

  • Long Roleplay sessions remain responsive without requiring refresh.
  • With no generation active, accent animation does not produce a large application-wide CSS-transition/DOM-event storm.
  • Opening, scrolling, and closing a large Gallery does not cause sustained performance degradation.
  • Main-thread long tasks and memory behavior are measured before and after in Firefox; Chromium should receive a basic regression check as well.
  • Reduced-effects mode fully suppresses recurring decorative work that can invalidate large UI subtrees.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Aug 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4696 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Marinara Engine becomes progressively less responsive during a long session, even when no response is being generated. A refresh restores normal performance. Opening and scrolling through a large image Gallery appears to accelerate the degradation, although the supplied Firefox recording indicates that the problem is broader than the Gallery alone. ## Expected behavior Marinara Engine should maintain stable input, scrolling, hover, and navigation responsiveness over a long session. Closing a large Gallery should stop its active work and allow image/DOM resources to be reclaimed without requiring a page refresh. ## Actual behavior Responsiveness gradually degrades the longer the application remains open. UI interactions become visibly laggy and main-thread stalls occur while no model generation is active. Refreshing the page immediately restores normal responsiveness. The supplied Firefox performance recording indicates two likely compounding sources: 1. Animated accent updates modify root-level CSS variables every 500 ms. One tick causes color and border transitions across hundreds of mounted controls, producing a large transition/event/task storm. 2. Gallery grids render original full-resolution image URLs. Images are lazy-loaded and asynchronously decoded, but the grid is not virtualized and there is no thumbnail endpoint. After scrolling through a large Gallery, Firefox may retain many decoded originals after the Gallery closes. The Gallery drawer itself appears to unmount correctly and cleans up its document pointer listener, so this should not initially be treated as a proven detached React-subtree leak. ## Steps to reproduce 1. Launch Marinara Engine in Firefox and use Roleplay mode for an extended session. 2. Open a Gallery containing many images and scroll through enough of it to load a substantial number of thumbnails. 3. Close the Gallery and continue navigating, scrolling, typing, and hovering in Marinara Engine without generating a response. 4. Observe that general UI responsiveness becomes progressively worse. 5. Refresh the page. 6. Observe that normal responsiveness returns immediately. A useful comparison is to repeat the same session with RGB Accent, Accent Pulse, custom-theme accent pulse, and Custom Cursor disabled, with **Reduce ambient animations and effects** enabled. ## Environment - Marinara Engine version: Not captured in the report; the profile contains React development-build frames - Install type: Source/development build (inferred from the supplied profiler recording) - OS + version: macOS 26.5.2, Apple silicon - Browser or app shell: Firefox 153 / Cocoa (profile build ID 20260803132010) ## Logs, screenshots, or video Firefox performance recording: `Firefox 2026-08-06 23.40 profile.json.gz` The approximately 26.2-second recording was captured while no response was being generated. Notable observations: - 36,109 CSS-transition markers, approximately 694 transitions per 500 ms accent tick - 221,013 DOM-event markers - 215,106 scheduled-task markers - Dominant transition events: approximately 72k `transitionrun`, 72k `transitionstart`, and 68k `transitionend` - Dominant transitioned properties: `color`, `scrollbar-color`, and individual border colors - Main-thread long tasks reached approximately 2.2 seconds; sampled event delay reached approximately 2.5 seconds - The Marinara content-process malloc counter rose from a post-collection low around 1.24 GB to approximately 1.47 GB by the end of the recording - Hot JavaScript stacks include `queueAccentAnimationTick` → `applyLiveAccent`, React mutation/passive/layout effect traversal, Roleplay surface updates, and custom-cursor color resolution - The closed Gallery did not appear as active React component work in the sampled timing data - Firefox Inspector/Compatibility tooling and the React development build amplified the absolute cost, but the recurring root-variable/transition storm originates in application behavior The malloc counter is not a heap snapshot, so its growth does not by itself prove a reachable-object leak. A production-build recording and before/after heap or `about:memory` comparison would help distinguish decoded-image caching from retained application objects. ## Additional context Relevant implementation observations: - The chat Gallery is conditionally mounted and its document event listener has an effect cleanup. - Gallery rows map the complete image collection and use original `/api/.../gallery/file/...` resources as visual thumbnails. The server returns the stored original file without resizing. - React Query retains Gallery metadata temporarily after unmount, but that metadata is lightweight and does not contain the decoded bitmap data. - Animated accents update root foreground/chrome variables every 500 ms. Many shared controls transition color and border properties based on those variables. - Custom Cursor color resolution performs a synchronous computed-style read in the recurring accent path. Suggested optimization boundary: - Prevent animated accent ticks from starting transitions across the entire mounted interface; isolate animated visuals or otherwise keep inherited control colors stable. - Remove synchronous computed-style work from recurring cursor recoloring. - Bound Gallery DOM and decoded-image cost through real thumbnails, responsive image sources, or simple virtualization/windowing. - Verify that closing Gallery/lightbox surfaces releases listeners and mounted nodes. - Compare a production build with DevTools closed before and after the optimization. Acceptance criteria: - Long Roleplay sessions remain responsive without requiring refresh. - With no generation active, accent animation does not produce a large application-wide CSS-transition/DOM-event storm. - Opening, scrolling, and closing a large Gallery does not cause sustained performance degradation. - Main-thread long tasks and memory behavior are measured before and after in Firefox; Chromium should receive a basic regression check as well. - Reduced-effects mode fully suppresses recurring decorative work that can invalidate large UI subtrees. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:50:26 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Aug 6, 2026):

Claimed by @SpicyMarinara. Implementation and validation are being tracked in draft PR #4697.

<!-- gh-comment-id:5209517334 --> @SpicyMarinara commented on GitHub (Aug 6, 2026): Claimed by @SpicyMarinara. Implementation and validation are being tracked in draft PR #4697.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2573
No description provided.