Last Sunday I wrote that my recording linker was live. It was running. It was matching recordings to the right lectures. It just hadn’t attached a single one.
Not one, in six days.
This was a short week in the repo: four commits, all on Tuesday evening, inside about twenty-five minutes. But one of them fixes a bug that had quietly turned “live” into “running and failing politely”, and the last one is about my Pi crashing. So it’s worth writing down.
The check I said I’d do
Last week’s post ended with a list of things still unverified against the real services. The biggest was whether an attachment would actually land on the event. That was this week’s check.
The answer was no. Every attach since going live on 21 October had come
back 412 Precondition Failed.
Here’s what the service does when it attaches a recording. It GETs the
calendar event, adds an ATTACH property, and PUTs it back with
If-Match: <the ETag it got>. That’s the polite way to write to a shared
calendar: “only save this if nobody changed the event since I read it.” If
someone did, the server says 412 and the service tries again on the next
poll.
The server said 412 every time. Nobody had changed anything.
The culprit: -gzip
My Nextcloud runs as Nextcloud AIO, and in front of it sits Apache.
The service’s HTTP client asks for compressed responses by default, so
Apache gzipped the event on the way out. And when Apache’s
mod_deflate compresses a response, it changes the ETag: it
appends -gzip to it. That’s its default behaviour, so that a compressed
and an uncompressed copy of the same thing don’t share a tag.
So the service read an ETag like "abc123-gzip" and sent it back in
If-Match. The server compared that to the event’s real ETag, "abc123".
They didn’t match. 412. Every time, forever.
The fix is one header. The event is now fetched with
Accept-Encoding: identity, uncompressed, so the ETag comes back exactly
as the server stores it. A calendar event is a few kilobytes. Nobody is
going to miss the compression.
Why nothing got lost
This is where last week’s slightly boring design choice paid off.
The service keeps no state. The watch folder is the inbox. A 412 is an
HTTP error, so the file was logged with “will retry” and left exactly where
it was. It never got moved to Unmatched either, because it had a match.
It just couldn’t be written down. The recordings sat in the inbox, waiting,
and the service knocked on the same door once a minute for six days.
And the health check never noticed. A failed write is logged and retried, the poll finishes, the heartbeat gets written, and Docker sees a healthy container. Six days of green.
And that’s the bit that stings. My test suite ran against Radicale and a fake of Nextcloud’s WebDAV. Neither has an Apache in front of it. Neither gzips anything. The tests were right about the code and wrong about the world it would run in.
Verified, for real this time
After the fix, the README got an honest update. Verified live on
27 October: the attach, as an override on that one occurrence of a
repeating event, and the MOVE to Attached afterwards. Still
unverified: whether the attachment shows up in the Calendar app like one
I’d picked myself. One more box. Next week.
A second calendar
The same commit taught the service to watch more than one calendar.
CALENDAR is now a comma-separated list, academics,medical, and a
recording goes to the best-matching event across all of them.
Lectures aren’t the only thing I want a recording of. Doctor’s
appointments are the obvious other one. Everything important gets said
in ten minutes, and you’re supposed to remember all of it on the way out. Now that
recording ends up on the appointment itself, in the medical calendar.
The log line names the calendar too, so I can tell at a glance which one a
file went to.
Small change. About fifty lines. The kind I like: it extends a thing that already works instead of building a new one.
Opus, not m4a
Also on Tuesday, the phone’s recorder (Fossify Voice Recorder)
switched from m4a to Opus, in an Ogg container. The first one was
20261027_210033.ogg, recorded a few minutes before the README commit
that mentions it.
No code change was needed for that. I tested an 83-minute Opus recording, as .ogg and as .opus. The
file is 23 MB. The service read its duration from 187 KiB of it,
through HTTP Range requests, with mutagen. It never downloads the
rest.
23 MB for 83 minutes of a lecture hall. Hard to argue with.
The Pi crashed
The last commit of the week was the one I didn’t want to write.
On Tuesday the kernel hit an Oops in kswapd, the kernel thread
that reclaims memory, on a corrupted pointer in the dentry cache. The Pi
rebooted.
Two weeks ago I overclocked it to 2.7 GHz and told you how carefully I’d picked the number. Ten minutes of all-core stress held around 78°C, peaking at 79.6°C, just under the 80°C where the firmware throttles. No throttle flags. Verified results. It was the highest clock that never throttled with this fan.
None of that rules out a single bit flipping once, on a Tuesday, in the middle of memory reclaim.
I can’t prove the overclock did it. One Oops is one data point, and kernels
crash for other reasons. But a corrupted pointer in a hot kernel path, on a
CPU running 300 MHz past stock, is exactly the kind of thing you’d expect
from a clock that’s almost stable. So the same evening it went down to
arm_freq=2600, which had also passed the stability tests back on
12 October. The 2.7 GHz config is kept beside it as
config.txt.bak-2026-10-27, in case I ever change my mind.
What does 2.6 buy? Over stock 2.4 GHz, measured with the other services stopped: +5.5% prefill, +3.3% decode. The “roughly 7% and 4%” I quoted for 2.7 was never measured directly; it sat between the 2.6 and 2.8 results. So the step back costs me something like a percentage point on each.
A percentage point, for a Pi that doesn’t fall over. Easy trade.
The lesson isn’t new, but I clearly needed it again: “never throttles” isn’t the same as “stable”. Ten minutes of stress-ng tests heat. It doesn’t test two weeks of real workloads touching every corner of memory.
The takeaway
Both stories this week are the same story. A test that passed, in a world that wasn’t quite the real one. A fake server with no Apache in front of it. A stress test that measured temperature, not two weeks of uptime.
So here’s my ask: pick one thing you’ve called “done” or “live” recently, and go check its output, not its logs or its health check. Is the file actually there? Did the email actually arrive? Mine had a green health check for six days while failing every write. Go look.
Sources
- Apache
mod_deflate,DeflateAlterETag, on the-gzipsuffix it adds to ETags - RFC 9110 (HTTP Semantics),
If-Matchand 412 Precondition Failed - Nextcloud All-in-One
- RFC 5545 (iCalendar), on
ATTACHandRECURRENCE-ID - Radicale, the CalDAV server used for testing
- Opus, Fossify Voice Recorder and mutagen
- Raspberry Pi
config.txtoverclocking options - Linux kernel docs: bug hunting and Oops messages
- The commit history of my homelab repo, 27 October 2026