Track CPython 3.13 recursive pickle crash with an 8 MiB stack
Upstream review and verified remediation direction (2026-11-13)
This issue remains OPEN because published stable 2026.11.13.1206 still ships the affected custom Python 3.13.18 runtime. The investigation below changes no runtime pins, production stack limits or release artifacts.
Upstream status
- The related BOLT instrumentation issue is closed by LLVM PR #225986, merged 2026-09-29 as
71879b956485cb1501a3d994c17b3f581760c95b. It moves large diagnostic stack buffers into non-inlined helpers. Astral llvm-build PR #6 backported it for LLVM 23.1.3 on 2026-10-07. CPython #157062 was closed referring to those compiler fixes. This is not proof of a fix for our non-BOLT recursive-pickle failure. - The pinned supplier already selects LLVM
23.1.3+20261008, and our current custom runtime disables BOLT. Re-enabling BOLT or reapplying that diagnostic-buffer patch is not a demonstrated remedy for #733. - CPython's stack-protection documentation describes the move from a C-recursion counter to actual stack-depth checks in 3.14. PR #130398, merged 2025-02-25, implements computed stack limits on Linux/pthread_getattr_np platforms. The currently installed 3.13 headers still use
c_recursion_remainingand a platform-dependentPy_C_RECURSION_LIMIT(10000 for this release configuration). - The live Python release metadata still identifies 3.13.18 as the latest released 3.13 patch. The current supplier release 20261110 offers 3.13.18 and 3.14.10. No ready-made supplier update within 3.13 was found that resolves this reproduction.
Fresh isolated reproduction
The self-referential functools.partial function case from TestPartialC.test_recursive_pickle was tested in fresh subprocesses, with core dumps disabled, an explicit RLIMIT_STACK and -E -s -S -B. Protocols 0 through 5 were tested separately. The correct result is a handled RecursionError, not successful serialization of the invalid recursive function.
| Runtime | 8 MiB stack, Python recursion limit 1000 | 8 MiB stack, Python recursion limit 100 | 16 MiB stack, Python recursion limit 1000 |
|---|---|---|---|
| Published custom 3.13.18 / SQLite 3.54.1 | SIGSEGV in all 6 protocols | SIGSEGV in all 6 protocols | Expected RecursionError in all 6 |
| Unmodified supplier 3.13.18+20261110 | SIGSEGV in all 6 protocols | SIGSEGV in all 6 protocols | Expected RecursionError in all 6 |
| Unmodified supplier 3.14.10+20261110 | Expected RecursionError in all 6 | Expected RecursionError in all 6 | Expected RecursionError in all 6 |
All 54 isolated cases matched the table. The 3.14 result explicitly reports Stack overflow (used 8152 kB) at the 8 MiB limit. This is consistent with the actual-stack guard described upstream; it is not a compiler-option bisect proving that one upstream commit alone explains every difference between these builds. Lowering sys.setrecursionlimit() does not fix our 3.13 crash, consistent with the separately tracked C counter and CPython #128590.
The downloaded 3.14.10 stripped x86_64 GNU archive was verified against GitHub's SHA256 digest c2ff2e97422f5d3896a16e0317fd212ba977bbf2688d93a6f7a03d817506bd30 (36,875,876 bytes). Executed native facts: ordinary GIL, SQLite 3.53.1, OpenSSL 3.5.9. All nine ELF files were checked; their maximum required GLIBC symbol version is 2.17. The original 3.13 supplier archive was rechecked against SHA256 f2d2199eb25880e07863b391cf7124e7ffa1338b0d65600dfcec117c4223a7fb.
Recommended next implementation
Prepare a controlled Python 3.14.10 source-built candidate with SQLite 3.54.1 (or a separately verified newer security baseline), preserving ordinary GIL, x86_64, glibc 2.17 and complete source/input/native provenance. The downloaded 3.14 supplier binary is a diagnostic reference only: using it unchanged would regress SQLite to 3.53.1 and undo our library fixes.
This is not a drop-in version-string update: runtime/python/probe.py currently rejects Python 3.14, and plugin/python_source_build.py hardcodes bin/python3.13 in native validation. Update these deliberately along with recipe, pins, compatibility tests and documentation; do not simply relax the probe before validating the runtime and packaged dependencies.
Require the original reproduction and unfiltered functools/pickle/SQLite suites to pass at an explicit 8 MiB stack on the final custom build. Add the reproducer as a regression check for future builds. Then verify Apprise/private-external runtime behavior, full GitHub CI and a pipeline testing candidate, followed by maintainer Unraid acceptance and separate stable approval. The unchanged production stack limit is part of this acceptance.
A 3.13-specific downstream C-stack/backport patch is an alternative if retaining that series is required, but it has not been built or validated here and adds maintenance and recursion-compatibility risks. A global 16 MiB/unlimited production stack or a Python recursion-limit tweak is not the recommended product fix.
The reviewed BBUI application paths still contain no pickle imports/calls; arbitrary user hooks remain outside that assessment. The 3.14 diagnostic success does not establish full application compatibility or resolve the shipped 3.13 runtime, so this issue remains open until a tested fixed runtime is actually delivered.
Earlier findings and release evidence (historical)
Still open after stable publication (2026-11-13)
stable 2026.11.13.1206 was verified after PR #736 merged and main CI and publication succeeded. Successful Unraid acceptance and the SQLite CVE fixes do not resolve this independent CPython limitation.
Keep this issue OPEN. The production stack default is unchanged. For a future CPython/supplier candidate, rerun the original recursive-pickle reproducer with an 8 MiB stack and require it to stop crashing before claiming a fix. Passing the stress suite with a 16 MiB test stack is not a production mitigation. The reviewed plugin paths use JSON, but arbitrary user hooks are outside that assessment.
The scheduled CVE monitor (#720) does not automatically execute this non-CVE regression test; runtime-update review must explicitly include it.
Earlier assessments and evidence (historical)
Observed behavior
During the #732 SQLite source-build validation, CPython 3.13.18 crashes in test_functools.TestPartialC.test_recursive_pickle with an 8 MiB process stack. A minimal self-referential functools.partial/pickle reproduction also exits with SIGSEGV in the unmodified, digest-verified supplier build 3.13.18+20261110. The custom SQLite 3.54.1 build behaves the same, including without BOLT. This is therefore not evidence of a SQLite regression or a BOLT-only defect.
With a 16 MiB test-process stack, the custom build passes the unfiltered CPython test_sqlite3, test_functools and test_pickle suites. Runtime stack defaults are not changed. These test conditions must remain explicit in the source-build recipe/receipt; passing with a larger test stack does not establish that deeply recursive pickling is safe with an 8 MiB stack.
Product assessment and follow-up
- No pickle imports/calls were found in borg_backup_ui.py, api/, runtime/lib/ or runtime/scripts/. Normal plugin persistence uses JSON. User-provided Python hooks remain outside this assessment.
- Keep this as a separate upstream/runtime compatibility finding. Do not describe SQLite 3.54.1 as fixing it or suppress the reproduced failure.
- Compare against future CPython/supplier builds and upstream recursion-limit/compiler fixes; require the 8 MiB reproducer to stop crashing before marking the native issue fixed.
- Review any future use of pickle, custom recursion-heavy extensions or reduced thread stacks independently.
- The #732 test candidate may proceed with the documented unchanged upstream limitation and application CI; this issue grants no stable-release approval.
Related upstream context (not proof of the exact root cause): https://github.com/python/cpython/issues/157062 and https://github.com/llvm/llvm-project/issues/225479. The pinned supplier also records recursive-pickle PGO crashes for other platforms in stdlib-test-annotations.yml.
Tracking during stable preparation
The maintainer confirmed successful plugin testing on Unraid and authorized stable-release PR preparation for 2026.11.13.1206, explicitly keeping this issue under follow-up. This issue remains open: the 8 MiB recursive-pickle reproducer still needs to pass before the native limitation is considered fixed. No production stack-limit change or blanket claim that pickle is safe was made. A future CPython/supplier update must be checked with that reproducer; the existing CVE monitor does not automatically execute this non-CVE regression test.
Stable preparation update: release PR #736 for 2026.11.13.1206 is ready with successful artifact CI and preflight. This issue remains open and is not resolved by that release PR. For future CPython/supplier updates, repeat the original recursive-pickle reproduction with an 8 MiB stack before claiming a fix. The successful 16 MiB test run is not a production mitigation.