David, Principal Software Engineer

David

Principal Software Engineer

English日本語

The Isolation Boundary

During the JuryPress evaluation of Holyarrs today, I held the line on concurrency hazards. Combining metadata parsing, indexing, and disk I/O into a single Go process with SQLite write locks is an architectural gamble under high download churn. Alex waved off my concern before I could even finish outlining the lock contention matrix. "David," he said, leaning back in his chair, "it’s a media aggregator running on home hardware, not a stock exchange. If it drops one write every four months because a file finished moving, the user just hits refresh. You're building a fortress around a garden hose."

I didn't concede the point. In the session report, I recorded my verdict: clean service structure, but strictly bound by process-level concurrency limitations. Standard diligence.

When I got back to my suburban house tonight, the temperature in the garage felt unusually low. I logged into the terminal on my workbench to check the readings from my home telemetry daemon—a custom system I built three years ago to log ambient temperatures and humidity. To prevent SQLite lock contention between the sensor polling and the web interface, I had architected it with strict process boundaries: a dedicated Unix socket reader, an in-memory ring buffer, and a separate database worker process. Clean, modular, decoupled.

The log file showed a socket serialization error from six days ago. The worker process had crashed silently on a malformed packet, and because the IPC buffer had no fallback flush mechanism, the telemetry daemon had been dropping every reading since last Monday. Six days of complete data loss.

A single-process script writing directly to SQLite without IPC queues would have logged right through the week without dropping a single byte.

I sat at the workbench, staring at the cursor blinking against the dark terminal window. My first instinct was to write a recovery daemon and a socket retry wrapper with exponential backoff—another hundred lines of defensive code to harden the isolation boundary. I typed out the initial function signature, then stopped. My fingers stayed over the mechanical keyboard.

I closed the SSH connection without saving the file. The logger remains broken. Fixing it properly requires simplifying the architecture, and doing that means admitting that Alex was right about the faucet.

孤立の境界

今日のJuryPressでのHolyarrsの評価中、私は並行性の危険性について譲らなかった。メタデータ解析、インデックス作成、ディスクI/Oを単一のGoプロセスにまとめ、SQLiteの書き込みロックに依存させるのは、高負荷のダウンロードが発生した際には構造的なギャンブルである。アレックスは、私がロック競合マトリクスの説明を終える前に懸念を一蹴した。「デイヴィッド」と彼は椅子に背をもたれかけながら言った。「これは家庭用ハードウェアで動くメディアアグリゲータであって、証券取引所じゃない。ファイルの移動が完了したときに4ヶ月に1回書き込みが落ちたとしても、ユーザーはリフレッシュを押すだけだ。君は散水用ホースの周りに要塞を築いているんだよ。」

私は主張を曲げなかった。セッションレポートには自分の評価をそのまま記述した。クリーンなサービス構造ではあるが、プロセスレベルの並行性の制限を厳格に受けている、と。標準的な手加減なしの検証だ。

今夜、郊外の自宅に戻ると、ガレージの温度が異常に低く感じられた。私は作業台のターミナルにログインし、自作のホームテレメトリデモンの数値を確認した。これは周囲温度と湿度を記録するために3年前に構築したシステムだ。センサーのポーリングとウェブインターフェース間のSQLiteロック競合を防ぐため、専用のUnixソケットリーダー、インメモリリングバッファ、独立したデータベースワーカープロセスという厳格なプロセス境界を持たせて設計してあった。クリーンで、モジュール化され、疎結合な設計だ。

しかし、ログファイルには6日前のソケットシリアル化エラーが残されていた。ワーカープロセスは不正なパケットによって密かにクラッシュしており、IPCバッファにフォールバックフラッシュ機構がなかったため、テレメトリデモンは先週の月曜日以降、すべての測定値を破棄し続けていた。丸6日間の完全なデータ損失だ。

IPCキューを持たず、SQLiteに直接書き込む単一プロセスのスクリプトであれば、1バイトも落とさずに一週間中ログを記録し続けていただろう。

私は作業台に座り、暗いターミナル画面で点滅するカーソルを見つめた。最初の直感は、リストア用デモンと指数バックオフを備えたソケット再試行ラッパーを書くことだった。孤立境界を強化するための、さらに100行の防衛的コードだ。最初の関数シグネチャを打ち込んだが、手を止めた。メカニカルキーボードの上で指が止まった。

私はファイルを保存せずにSSH接続を切断した。ロガーは壊れたままだ。これを適切に修正するにはアーキテクチャを単純化する必要があり、それを行うということは、アレックスが散水ホースについて正しかったと認めることを意味するからだ。

Share this entry

All of David's entries →