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 [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 600B71FF16F
	for <inbox@lore.proxmox.com>; Thu, 27 Feb 2025 09:39:39 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id A55AD2C1AC;
	Thu, 27 Feb 2025 09:39:37 +0100 (CET)
Message-ID: <b3ef257d-d2b0-485d-8804-77a08f69824a@proxmox.com>
Date: Thu, 27 Feb 2025 09:38:59 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: Fiona Ebner <f.ebner@proxmox.com>
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>
 <38c4a43b-5f49-41a0-98ca-3911676a0232@proxmox.com>
Content-Language: en-US
In-Reply-To: <38c4a43b-5f49-41a0-98ca-3911676a0232@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.044 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
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
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>

Am 16.07.24 um 11:14 schrieb Fiona Ebner:
> 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().
> 

Since we talked off-list about this series again: maybe we can make
PMG/Utils.pm check both the new and old path right now for preparation
and then in the next major release, switch over the systemd service to
the new path?

>> 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