Repository navigation
[fix] Avoid PyArrow 25 thread initialization crash - #15947
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
9d754b8 to
a1534f5
Compare
|
| Filename | Overview |
|---|---|
| .github/actions/make_init/action.yml | Runs protobuf generation before final environment logging and adds PyArrow runtime diagnostics. |
| .github/actions/playwright_install/action.yml | Adds Playwright dry-run output after browser installation; the diagnostic command should not be allowed to fail setup. |
| e2e_playwright/conftest.py | Adds teardown logging when an E2E subprocess exits before cleanup. |
| lib/pyproject.toml | Adds the pyarrow<25 cap with an upstream crash note. |
Reviews (1): Last reviewed commit: "chore: improve e2e environment diagnosti..." | Re-trigger Greptile
| python -m playwright install | ||
| fi | ||
| echo "Installed Playwright browser versions:" | ||
| python -m playwright install --dry-run |
There was a problem hiding this comment.
Diagnostic Command Can Fail Setup
This dry-run command is only used for logging, but it now runs under the same failing shell step as the browser install. If the pinned Playwright CLI ever returns a nonzero status for install --dry-run in a cache or dependency-check edge case, the action fails after the browsers were already installed successfully.
| python -m playwright install --dry-run | |
| python -m playwright install --dry-run || true |
There was a problem hiding this comment.
Summary
This PR fixes a segfault caused by PyArrow 25.0.0's bundled mimalloc 3.3.1 when first imported from a short-lived worker thread (triggered by Streamlit's ScriptRunner). The fix caps PyArrow at <25 in lib/pyproject.toml until the upstream issue (apache/arrow#50471) is resolved.
Additionally, CI diagnostics are improved:
- The "Show environment info" step is moved after
make protobufso reported dependency versions reflect the final environment state. - PyArrow version and memory pool backend are logged.
- Installed Playwright browser revisions are printed via
--dry-run. e2e_playwright/conftest.pynow logs process exit code and signal when an app server dies before teardown, aiding future crash diagnosis.
Reviewer consensus: Both reviewers (claude-4.6-opus-high-thinking, gpt-5.3-codex-high) approved unanimously with no blocking issues identified.
Code Quality
All changes are well-structured, minimal, and follow existing patterns:
- CI workflow changes in composite actions are clear and consistent with the existing action structure.
- The
conftest.pychange is surgically placed at the top ofterminate()before_stop_process()is called, preserving existing control flow and only adding observability. - The
pyproject.tomlchange is well-commented with a reference to the upstream issue.
No structural or maintainability concerns were raised by either reviewer.
Test Coverage
No new unit or E2E tests are added, which both reviewers agree is appropriate for this scope:
- Dependency version constraints are validated by the pip resolver at install time.
- CI diagnostics are validated by CI runs themselves.
- The
conftest.pydiagnostic print is test infrastructure, not application logic.
The PR description includes successful Playwright workflow runs (5809 passed, 233 skipped) validating the dependency cap change in practice.
Backwards Compatibility
The pyarrow<25 cap is the only user-facing change. It narrows the allowed version range from >=7.0 (unbounded above) to >=7.0,<25.
- Users on PyArrow 24.x are unaffected.
- Users who explicitly installed PyArrow 25 will be downgraded by pip when installing/upgrading Streamlit. This is intentional — PyArrow 25 causes crashes.
- The restriction is temporary and will be relaxed once the upstream fix lands.
No API or behavioral breaking changes.
Security & Risk
No security concerns identified by either reviewer:
- No new endpoints, auth changes, or network behavior.
- No new dependencies added.
- Diagnostic prints only output process metadata (PID, return code, command args) to CI logs — not user secrets or sensitive data.
- The version pin is a conservative restriction (removing a problematic version), not an expansion of attack surface.
External test recommendation
- Recommend external_test: No
- Triggered categories: None
- Evidence:
.github/actions/make_init/action.yml: CI step reordering and additional logging — no runtime behavior changes..github/actions/playwright_install/action.yml: Adds dry-run info output — no runtime behavior changes.e2e_playwright/conftest.py: Diagnostic print in test infrastructure — no runtime behavior changes.lib/pyproject.toml: Dependency version cap — no routing, auth, embedding, websocket, or asset serving changes.
- Suggested external_test focus areas: N/A
- Confidence: High
- Assumptions and gaps: None. All changes are to CI infrastructure or dependency constraints with no impact on Streamlit's runtime behavior in external/embedded contexts.
Accessibility
No frontend changes. Not applicable.
Recommendations
- (Optional) Consider adding a TODO comment in
pyproject.tomlto explicitly signal when to revisit the<25cap (e.g., "TODO: Remove once apache/arrow#50471 is fixed in PyArrow 25.0.1+ or 26.0.0"). The current comment references the issue but doesn't signal when to revisit. Both reviewers independently suggested this.
Verdict
APPROVED: Clean, well-scoped fix for a real segfault regression with appropriate CI diagnostics improvements. Both reviewers approved unanimously with no blocking issues.
Consolidated review by claude-4.6-opus-high-thinking from 2 model reviews: claude-4.6-opus-high-thinking, gpt-5.3-codex-high. All expected models completed their reviews successfully.
## Describe your changes PyArrow 25.0.0 bundles mimalloc 3.3.1, which can segfault when the library is first loaded on a short-lived worker thread and a later thread performs an Arrow allocation. Streamlit's ScriptRunner lifecycle triggers this pattern. The app server exits with signal 11, and Playwright subsequently reports connection refusals across otherwise unrelated tests and browsers. This change: - Caps PyArrow at `<25` until the upstream allocator issue is fixed. - Reports the final Python environment after `make protobuf`, since its `uv run` can update dependencies after the previous environment log. - Prints the installed Chromium, Firefox, and WebKit revisions. - Reports the exit code and signal when an E2E subprocess dies before teardown. Upstream issue: apache/arrow#50471 ## GitHub Issue Link (if applicable) N/A ## Testing Plan - Reproduced the crash locally with PyArrow 25.0.0 on Python 3.14: exit code 139. - Verified the same reproduction passes with PyArrow 24.0.0. - Verified PyArrow 25.0.0 passes with `ARROW_DEFAULT_MEMORY_POOL=system`. - Changed-files Playwright workflow: 334 passed, 8 skipped. - Full Playwright workflow with only `pyarrow<25`: 5809 passed, 233 skipped. - Custom-components Playwright workflow passed with only `pyarrow<25`. - `make python-lint` - `make python-types` - Pre-commit hooks
Describe your changes
PyArrow 25.0.0 bundles mimalloc 3.3.1, which can segfault when the library is
first loaded on a short-lived worker thread and a later thread performs an Arrow
allocation. Streamlit's ScriptRunner lifecycle triggers this pattern. The app
server exits with signal 11, and Playwright subsequently reports connection
refusals across otherwise unrelated tests and browsers.
This change:
<25until the upstream allocator issue is fixed.make protobuf, since itsuv runcan update dependencies after the previous environment log.
Upstream issue: apache/arrow#50471
GitHub Issue Link (if applicable)
N/A
Testing Plan
ARROW_DEFAULT_MEMORY_POOL=system.pyarrow<25: 5809 passed, 233 skipped.pyarrow<25.make python-lintmake python-types