Fix Viewer server crash: serialise grid rendering, stop component echo cascade - #99
Merged
Merged
Conversation
…o cascade The "random white screen that needs a refresh" is the Streamlit server process dying with a native access violation in polars (DataFrame.deserialize via st.cache_data) while two script threads render the FLASHDeconv Viewer at the same time. Streamlit's default runner.fastReruns starts a new script thread on every rerun request while the previous one is still executing, and every grid cell of the Vue component used to send a rerun request on mount and on every echoed render, so one Viewer load produced up to a dozen overlapping runs. Reproduced three times with faulthandler; details, timeline and measurements in docs/white-screen-root-cause.md. - src/render/render.py: per-session lock around render_grid (keyed by Streamlit session id) so a stopped runner can never execute the grid code concurrently with the new one. - js-component/dist: bundle rebuilt from openms-streamlit-vue-component branch fix/viewer-echo-cascade (no setComponentValue on mount, no echo of Python-provided state, no duplicate payloads). - docs/white-screen-root-cause.md: root cause analysis, secondary findings (source watcher purging modules, teleported filter dialog overlay), fix options and before/after measurements. Measured (Edge, 5 trials, median): rerun requests per Viewer load 20 -> 4, script runs 11 -> 5, load settled 2.47 s -> 2.06 s, return-to-Viewer settled 1.33 s -> 0.19 s, row click 0.45 s -> 0.27 s; two 60-click stress runs with no crash (before: crashes after 4 and 6 clicks). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wda4mDs1DSWJuU1beJJKvL
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 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 |
This was referenced Sep 10, 2026
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.
Summary
Fixes the "random white screen that needs a refresh" reported by users. It is the Streamlit server process dying with a native access violation (
polars DataFrame.deserialize, called fromst.cache_data) while two script threads render the FLASHDeconv Viewer at the same time. Reproduced three times with faulthandler; full analysis, timeline and measurements indocs/white-screen-root-cause.md(added in this PR).Root cause chain:
setComponentValueon mount and on every echoed render; Streamlit turns each one into a full rerun request (no dedup), so one Viewer load produced 20 rerun requests and 8-12 script runs.runner.fastRerunsstops the running ScriptRunner and starts a new script thread immediately, while the old thread keeps executing until its next Streamlit call (which never comes inside the polars/pyarrow work ofinitialize_data/filter_data).st.cache_datapickles; polars' native deserializer crashes the whole process. Users see CONNECTING, then "Connection error", or an empty white page if the crash lands right after a sidebar click.Changes
src/render/render.py: per-session lock aroundrender_grid(keyed by Streamlit session id). A runner that has been stopped releases the lock at its next Streamlit call, so the grid code can never run twice concurrently for one session. This alone removes the crash class.js-component/dist/: bundle rebuilt from Send selection state to Streamlit only on genuine user interaction t0mdavid-m/openms-streamlit-vue-component#30 (nosetComponentValueon mount, no echo of Python-provided state, no duplicate payloads). CI clonesFVdeployfresh, so that PR must be merged for CI builds to include the Vue side; the committed bundle covers local runs and the Windows build meanwhile.docs/white-screen-root-cause.md: analysis, secondary findings, fix options and the before/after measurements.Not included (separate follow-ups, documented in the analysis): the source watcher purging
src.*modules because the packages have no__init__.py(add them or run production with--server.fileWatcherType none), the teleported table filter dialog leaving an overlay behind on navigation, and running production withPYTHONFAULTHANDLER=1.Measurements (Edge via Playwright, 5 trials, median; default
fastReruns, faulthandler on)--runner.fastReruns falsewas also tried: no crash, but the Viewer stalls at one cell and ignores navigation, so the default stays.Test plan
npm run buildand type check of the Vue component pass; bundle loads, grid renders, row click still updates the other cellsfatal exceptionin the server logs🤖 Generated with Claude Code
https://claude.ai/code/session_01Wda4mDs1DSWJuU1beJJKvL