Skip to content

cache: tolerate corrupt cache files + silence granian close-frame DEBUG#704

Merged
ajslater merged 1 commit intov1.11-performancefrom
claude/nervous-torvalds-f3e019
May 3, 2026
Merged

cache: tolerate corrupt cache files + silence granian close-frame DEBUG#704
ajslater merged 1 commit intov1.11-performancefrom
claude/nervous-torvalds-f3e019

Conversation

@ajslater
Copy link
Copy Markdown
Owner

@ajslater ajslater commented May 3, 2026

Summary

  • A truncated zlib stream in the Django file cache (left by a write killed mid-flush) was bubbling up to users as zlib.error: Error -5 while decompressing data: incomplete or truncated stream with a full traceback. New ResilientFileBasedCache treats a corrupt entry as a miss, deletes the bad file, and logs at DEBUG instead of failing the request.
  • Silenced Granian's routine Received close frame / Replying to close DEBUG noise (every normal client disconnect emits two lines). Pinned _granian to INFO alongside the existing asyncio entry; still visible at TRACE.

Test plan

  • make fix, make ty, make test-python (26 passed) all green
  • Smoke-tested the new cache backend: a deliberately truncated .djcache file at the same path shape as the production traceback is silently dropped; get_many returns the surviving keys
  • Verified _granian effective level is INFO after dictConfig(LOGGING)

🤖 Generated with Claude Code

A truncated zlib stream in the file cache (left behind by a write killed
mid-flush) was bubbling up as a 500 with a scary `zlib.error: Error -5`
traceback into user-facing logs. ResilientFileBasedCache now treats a
corrupt entry as a miss, deletes the bad file, and logs at DEBUG.

Also silence Granian's routine "Received close frame" / "Replying to
close" DEBUG noise (paralleling the existing watchfiles entry); still
visible at TRACE.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ajslater ajslater merged commit 11e06de into v1.11-performance May 3, 2026
1 check failed
ajslater added a commit that referenced this pull request May 4, 2026
The earlier ``_granian`` filter (#704) didn't catch the close-frame
DEBUG messages users were still seeing — those originate from the
``tungstenite`` and ``tokio_tungstenite`` crates that Granian uses
for the WebSocket layer, not from ``_granian`` itself.

pyo3-log routes Rust tracing targets to Python loggers, mapping
``::`` → ``.`` so e.g. ``tungstenite::protocol`` arrives as the
Python logger ``tungstenite.protocol``. Filtering the bare crate
name applies hierarchically to all submodules.

Verified by applying the dictConfig and reading effective levels:
``tungstenite.protocol`` and ``tokio_tungstenite.compat`` now resolve
to INFO with ``isEnabledFor(DEBUG) == False``; root stays at DEBUG
so codex code is unaffected.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ajslater ajslater deleted the claude/nervous-torvalds-f3e019 branch May 4, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant