Repository navigation
fix: release Panel views leaked by destroyed sessions; pin image Python - #65
Merged
Merged
Conversation
Every closed session leaked in production: Panel registers the per-session NotificationArea in pn.state._views and only removes it via state._notifications[doc], which Panel's own Document.destroy override deletes before Bokeh runs session-destroyed callbacks. The orphaned entry pins the dead Document and often the whole ChannelmapGUI (~90k Electrode objects), so RSS climbed to ~3.4 GB until the container was OOM-killed. Register _release_dead_session_views on session destroy to drop every _views entry still pointing at the dead document. Under the same load idle RSS after cleanup falls from ~1.3-1.4 GB to ~660 MB. Tests: an end-to-end Panel server test (fails before, passes after), unit tests for the hook's edge cases, and a strict-xfail canary that starts failing once Panel fixes the bug so the workaround can go. Refs #6 Assisted-by: ClaudeCode:claude-opus-5-5
uv downloads the newest CPython when unpinned; with 3.15 released, `uv sync` fails because dracopy 2.0.0 has no cp315 wheel or sdist, so the next tagged image build would fail. Refs #6 Assisted-by: ClaudeCode:claude-opus-5-5
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
=======================================
Coverage ? 68.03%
=======================================
Files ? 19
Lines ? 3013
Branches ? 0
=======================================
Hits ? 2050
Misses ? 963
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tabedzki
marked this pull request as ready for review
October 16, 2026 15:51
tabedzki
added a commit
to tabedzki/channelmap_generator
that referenced
this pull request
Oct 17, 2026
Release candidate so the Docker image picks up the Panel session-leak fix (m-beau#65) and the per-click gc.collect stall fix plus watchdog (m-beau#66). The v1.4.0 image leaks ~27-30 MB per closed session; an overnight scanner built ~160 sessions and pushed prod RSS to 4.45 GB against a 4500M cap. CITATION.cff stays on 1.4.0, the archived JOSS release. Assisted-by: ClaudeCode:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Refs tabedzki#6, which has the full investigation and reproduction.
Problem
The production container is OOM-killed after running for a while. Every closed browser tab can leak its session. Panel registers the per-session
NotificationAreainpn.state._viewsand only removes it throughstate._notifications[doc]. Panel's ownDocument.destroyoverride deletes that entry before Bokeh runs the session-destroyed callbacks, so the cleanup never runs. The orphaned entry pins the dead Document and often the wholeChannelmapGUI(about 90kElectrodeobjects). This happens on Panel 1.7.5 and the latest 1.9.4.Changes
_release_dead_session_views(), registered withon_session_destroyedincreate_app. It drops everypn.state._viewsentry still pointing at the dead session's document (calling_cleanupfirst, and still dropping the entry if that fails). It works regardless of hook order and also coversLocation/BrowserInfo, which follow the same pattern in Panel.Dockerfile:ENV UV_PYTHON=3.14. Unpinned, uv now picks CPython 3.15, wheredracopy2.0.0 has no wheel, so the next tagged image build would fail.Tests
_viewsentry survives for a destroyed Document. Fails before the fix, passes after.Nonedocument;_cleanupraising.xfail(strict=True)): plain Panel without the workaround. It xfails while the bug exists and starts failing once Panel fixes it, which is the signal to remove the workaround.Verification (production image vs this branch, Playwright load,
-m 3500m --memory-swap 3500m)Peaks are unchanged: concurrent sessions plus large-atlas overlay computations are a separate capacity problem, tracked in tabedzki#6.
Related
[watchdog]warnings. It is independent of this PR, and both merge cleanly ontomaintogether (565 passed, 1 expected xfail).Assisted-by: ClaudeCode:claude-opus-5-5