It's tempting to rely on the atomicity of smaller-than-PIPE_BUF
writes, but it doesn't work if mixed with larger ones.
---
 lib/PublicInbox/SearchIdxSkeleton.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/PublicInbox/SearchIdxSkeleton.pm 
b/lib/PublicInbox/SearchIdxSkeleton.pm
index 063c83e..506e566 100644
--- a/lib/PublicInbox/SearchIdxSkeleton.pm
+++ b/lib/PublicInbox/SearchIdxSkeleton.pm
@@ -80,6 +80,8 @@ sub index_skeleton {
        $str = length($str) . "\n" . $str;
 
        # multiple processes write to the same pipe, so use flock
+       # We can't avoid this lock for <=PIPE_BUF writes, either,
+       # because those atomic writes can break up >PIPE_BUF ones
        $self->_lock_acquire;
        print $w $str or $err = $!;
        $self->_lock_release;
-- 
EW

--
unsubscribe: meta+unsubscr...@public-inbox.org
archive: https://public-inbox.org/meta/

Reply via email to