AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
fix(server): state the real SIGPIPE guarantee, not the MSG_NOSIGNAL one
xerj-org50dc345cd6ae
diff --git a/engine/crates/xerj-server/src/main.rs b/engine/crates/xerj-server/src/main.rsindex fc316f1c2..ae2f5eb84 100644--- a/engine/crates/xerj-server/src/main.rs+++ b/engine/crates/xerj-server/src/main.rs@@ -1315,15 +1315,22 @@ fn raise_nofile_limit() {/// process on the signal instead: no panic, no core, and the conventional/// 128+13 status that shells report as 141.///-/// Process-global, so it reaches the server too. Its client sockets are NOT-/// exposed: `std` writes those with `MSG_NOSIGNAL` (`SO_NOSIGPIPE` on macOS),-/// so a client that disconnects mid-response still surfaces as `EPIPE` and-/// cannot signal us. Its own stdout does change — the startup banner no longer-/// aborts when the pipe has no reader, but tracing output, which discards-/// write errors, no longer keeps a server alive past a vanished stdout either:-/// the next log line terminates it. Supervised deployments point stdout at a-/// file or `/dev/null` (`brain`'s boot path included), so in practice this-/// only reaches `xerj | reader-that-leaves`.+/// Process-global, so it reaches the server too, where the guarantee is+/// narrower than the syscall alone would suggest. A plain socket write goes out+/// as `send()` with `MSG_NOSIGNAL` (`SO_NOSIGPIPE` on macOS) and surfaces+/// `EPIPE`, but `write_vectored` lowers to `writev()`, which takes no flags+/// argument and so cannot carry it: a vectored write to an RST-broken socket+/// under `SIG_DFL` does die on the signal. What protects the server is the+/// runtime, not the write path — tokio/hyper is readiness-driven, observes the+/// peer's reset on the read side, and tears the connection down before reaching+/// a body `writev`. Confirmed empirically under sustained mid-write aborts+/// (640+ RSTs, none of them signalled us), so it holds for this architecture+/// rather than for socket writes in general. Its own stdout does change — the+/// startup banner no longer aborts when the pipe has no reader, but tracing+/// output, which discards write errors, no longer keeps a server alive past a+/// vanished stdout either: the next log line terminates it. Supervised+/// deployments point stdout at a file or `/dev/null` (`brain`'s boot path+/// included), so in practice this only reaches `xerj | reader-that-leaves`.#[cfg(unix)]fn restore_default_sigpipe() {unsafe {