From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pmg-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 224271FF2A1
	for <inbox@lore.proxmox.com>; Tue, 16 Jul 2024 11:15:02 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id BF52FF99B;
	Tue, 16 Jul 2024 11:15:30 +0200 (CEST)
Message-ID: <38c4a43b-5f49-41a0-98ca-3911676a0232@proxmox.com>
Date: Tue, 16 Jul 2024 11:14:52 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Maximiliano Sandoval <m.sandoval@proxmox.com>, pmg-devel@lists.proxmox.com
References: <20240710143540.434073-1-m.sandoval@proxmox.com>
 <20240710143540.434073-2-m.sandoval@proxmox.com>
 <ec964b5f-4b97-4bcb-b96c-9676c2592d22@proxmox.com>
 <s8ottgq2784.fsf@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <s8ottgq2784.fsf@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [utils.pm]
Subject: Re: [pmg-devel] [PATCH api v4 02/10] pmg-smtp-filter: move pid file
 into /run/pmg-smtp-filter
X-BeenThere: pmg-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Mail Gateway development discussion
 <pmg-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pmg-devel/>
List-Post: <mailto:pmg-devel@lists.proxmox.com>
List-Help: <mailto:pmg-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pmg-devel-bounces@lists.proxmox.com
Sender: "pmg-devel" <pmg-devel-bounces@lists.proxmox.com>

CC-ing pmg-devel again

Am 15.07.24 um 14:02 schrieb Maximiliano Sandoval:
> Fiona Ebner <f.ebner@proxmox.com> writes:
> 
>> Am 10.07.24 um 16:35 schrieb Maximiliano Sandoval:
>>> diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
>>> index 5d9ded4..09cb42d 100644
>>> --- a/src/PMG/Utils.pm
>>> +++ b/src/PMG/Utils.pm
>>> @@ -1462,7 +1462,7 @@ sub get_pg_server_version {
>>>  
>>>  sub reload_smtp_filter {
>>>  
>>> -    my $pid_file = '/run/pmg-smtp-filter.pid';
>>> +    my $pid_file = '/run/pmg-smtp-filter/pmg-smtp-filter.pid';
>>>      my $pid = PVE::Tools::file_read_firstline($pid_file);
>>>  
>>>      return 0 if !$pid;
>>
>> Can there be a race here during/after update? I.e. service still running
>> with PID file in old path and reload_smtp_filter() is called only
>> checking the new path. Does something ensure this can't happen?
>> Otherwise, I suppose we'll need to check the old path too until the next
>> major release.
>>
>> And what about the other way around, i.e. service already running with
>> PID file in new path and old version of reload_smtp_filter() called
>> still checking the old path?
> 
> I am not entirely sure to be honest. Every service will be restarted
> after the install so at most there could be races during the install
> process.
> 

But the src/PMG/Utils.pm file is used by other services too, right?  And
it seems likely that reload_smtp_filter() can be reached by those, e.g.
one caller is PMG/Config.pm's rewrite_config().

> I am not sure how this is handled in perl, but my understanding is that
> the file is in memory until the service is restarted in which case I
> don't think there should be any race in this window either.
> 


_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel