]> git.ipfire.org Git - thirdparty/public-inbox.git/commit
lei: C++ xap_helper forks dynamically master
authorEric Wong <e@80x24.org>
Thu, 5 Feb 2026 03:47:17 +0000 (03:47 +0000)
committerEric Wong <e@80x24.org>
Fri, 6 Feb 2026 22:17:25 +0000 (22:17 +0000)
commit8a3c04bb01b243c28515df77e8ca647ec54dec01
treef23b5470dbe72946372c070e6ddcde5c99473c1e
parent48cb4586f9b242cbd22ee81e6d8857fef5968fd1
lei: C++ xap_helper forks dynamically

Rework xap_helper for lei to prefork before dynamically forking
a new worker on demand for every request.  We do this to ensure
the C++ xap_helper is usable ASAP and enable us to reliably skip
approxidate handling in Perl (and thus rely on our integration
of the C approxidate from git(1) with Xapian's QueryParser API).

Previously, we would v?fork+execve for every query, but it was
open to TOCTOU errors for deciding whether or not to do
approxidate processing in Perl or (C-flavored) C++.  Using
fexecve(2) was also considered, but that's not available from
pure Perl and I'm still hesitant to make Inline::C or XS a hard
requirement for us.

Public-facing xap_helper usage remains unchanged, since it's
expected public-facing daemons have dedicated resources
preconfigured while local software such as lei can be more
dynamic and flexible in its resource use.

There is no change to the Perl + (XS|SWIG) XapHelper
implementation, since it provides no benefit to lei users.
lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiQuery.pm
lib/PublicInbox/LeiSucks.pm
lib/PublicInbox/LeiUp.pm
lib/PublicInbox/LeiXSearch.pm
lib/PublicInbox/Search.pm
lib/PublicInbox/xap_helper.h
t/xap_helper.t