From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 3E8111F452 for ; Wed, 3 May 2023 06:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1683095605; bh=iFAbkZZ1L5/sfO+jzSiTnnhIqpD8J7JDLU+xisElUrs=; h=From:To:Subject:Date:From; b=R1gc2NFAnXGneusEo2CaH5IJOAMd69/QWKkLtVotheW+w5D1ZVV/R52XetuHQ9IzV ycYh0TdenrlJjsNAGY63QhNDC40a3oRMvddX9cxDLyuZyZRAn/vLsWpMJt8+6mWBjV PhaBfDq4XZKejWfxNK3LWhKi352vDCwFNdgMH5b0= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] ipc: get rid of lock support Date: Wed, 3 May 2023 06:33:25 +0000 Message-ID: <20230503063325.3483577-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: SOCK_SEQPACKET is used whenever we care about parallel writes to a socket, so there's no need to mess with locks in userspace code. --- I only noticed this since I was poking around in ~/.local/share/lei/store created from a pre-release and noticed ipc.lock lingering... lib/PublicInbox/IPC.pm | 11 ----------- t/ipc.t | 1 - 2 files changed, 12 deletions(-) diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index cca3dacb..c154724e 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -173,15 +173,6 @@ sub ipc_worker_stop { awaitpid($pid) if $$ == $ppid; # for non-event loop } -# use this if we have multiple readers reading curl or "pigz -dc" -# and writing to the same store -sub ipc_lock_init { - my ($self, $f) = @_; - $f // die 'BUG: no filename given'; - require PublicInbox::Lock; - $self->{-ipc_lock} //= bless { lock_path => $f }, 'PublicInbox::Lock' -} - sub _wait_return ($$) { my ($r_res, $sub) = @_; my $ret = _get_rec($r_res) // die "no response on $sub"; @@ -193,8 +184,6 @@ sub _wait_return ($$) { sub ipc_do { my ($self, $sub, @args) = @_; if (my $w_req = $self->{-ipc_req}) { # run in worker - my $ipc_lock = $self->{-ipc_lock}; - my $lock = $ipc_lock ? $ipc_lock->lock_for_scope : undef; if (defined(wantarray)) { my $r_res = $self->{-ipc_res} or die 'no ipc_res'; _send_rec($w_req, [ wantarray, $sub, @args ]); diff --git a/t/ipc.t b/t/ipc.t index fd4d5599..7bdf2218 100644 --- a/t/ipc.t +++ b/t/ipc.t @@ -90,7 +90,6 @@ $test->('local'); defined($pid) or BAIL_OUT 'no spawn, no test'; is($ipc->ipc_do('test_pid'), $pid, 'worker pid returned'); $test->('worker'); - $ipc->ipc_lock_init("$tmpdir/lock"); is($ipc->ipc_do('test_pid'), $pid, 'worker pid returned'); $ipc->ipc_worker_stop; ok(!kill(0, $pid) && $!{ESRCH}, 'worker stopped');