all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pmg-api v2] fix #7407: cluster: report: increase maximal filesize to 2M
@ 2026-03-16 12:12 Stoiko Ivanov
  2026-03-16 12:17 ` Stoiko Ivanov
  2026-03-16 12:18 ` Shannon Sterz
  0 siblings, 2 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2026-03-16 12:12 UTC (permalink / raw)
  To: pmg-devel

the postfix configuration files are read via PVE::INotify in our
stack and have not implicit limit.

PMG::Cluster and PMG::Report do read the same file's contents using
`file_get_contents` with a limit (explicitly set, or implicit) of 1M.

This causes the cluster-sync to fail in one reported deployment
hosting ~40k domains, with explicit transport entries and comments
(resulting in a 1.4M /etc/pmg/transport).

As it's the first occurrence of this causing an issue doubling the
limit to 2M, instead of increasing it further seems appropriate.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
v1->v2:
* increase size to 4M based on feedback from Dominik - thx!

 src/PMG/Cluster.pm | 4 ++--
 src/PMG/Report.pm  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PMG/Cluster.pm b/src/PMG/Cluster.pm
index 02d727ee..3e0b12ac 100644
--- a/src/PMG/Cluster.pm
+++ b/src/PMG/Cluster.pm
@@ -266,10 +266,10 @@ my $cond_commit_synced_file = sub {
         return;
     }
 
-    my $new = PVE::Tools::file_get_contents($srcfn, 1024 * 1024);
+    my $new = PVE::Tools::file_get_contents($srcfn, 4096 * 1024);
 
     if (-f $dstfn) {
-        my $old = PVE::Tools::file_get_contents($dstfn, 1024 * 1024);
+        my $old = PVE::Tools::file_get_contents($dstfn, 4096 * 1024);
         return 0 if $new eq $old;
     }
 
diff --git a/src/PMG/Report.pm b/src/PMG/Report.pm
index 84d1b887..58756c77 100644
--- a/src/PMG/Report.pm
+++ b/src/PMG/Report.pm
@@ -72,7 +72,7 @@ sub dir2text {
         sub {
             my ($file) = @_;
             $report .= "\n# cat $target_dir$file\n";
-            $report .= PVE::Tools::file_get_contents($target_dir . $file) . "\n";
+            $report .= PVE::Tools::file_get_contents($target_dir . $file, 4096 * 1024) . "\n";
         },
     );
 }
-- 
2.47.3





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH pmg-api v2] fix #7407: cluster: report: increase maximal filesize to 2M
  2026-03-16 12:12 [PATCH pmg-api v2] fix #7407: cluster: report: increase maximal filesize to 2M Stoiko Ivanov
@ 2026-03-16 12:17 ` Stoiko Ivanov
  2026-03-16 12:18 ` Shannon Sterz
  1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2026-03-16 12:17 UTC (permalink / raw)
  To: pmg-devel

superseded by:
https://lore.proxmox.com/pmg-devel/20260316121712.30273-1-s.ivanov@proxmox.com/T/#u

where the commit-message was also adapted

sorry for the noise

On Mon, 16 Mar 2026 13:12:43 +0100
Stoiko Ivanov <s.ivanov@proxmox.com> wrote:

> the postfix configuration files are read via PVE::INotify in our
> stack and have not implicit limit.
> 
> PMG::Cluster and PMG::Report do read the same file's contents using
> `file_get_contents` with a limit (explicitly set, or implicit) of 1M.
> 
> This causes the cluster-sync to fail in one reported deployment
> hosting ~40k domains, with explicit transport entries and comments
> (resulting in a 1.4M /etc/pmg/transport).
> 
> As it's the first occurrence of this causing an issue doubling the
> limit to 2M, instead of increasing it further seems appropriate.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> v1->v2:
> * increase size to 4M based on feedback from Dominik - thx!
> 
>  src/PMG/Cluster.pm | 4 ++--
>  src/PMG/Report.pm  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/PMG/Cluster.pm b/src/PMG/Cluster.pm
> index 02d727ee..3e0b12ac 100644
> --- a/src/PMG/Cluster.pm
> +++ b/src/PMG/Cluster.pm
> @@ -266,10 +266,10 @@ my $cond_commit_synced_file = sub {
>          return;
>      }
>  
> -    my $new = PVE::Tools::file_get_contents($srcfn, 1024 * 1024);
> +    my $new = PVE::Tools::file_get_contents($srcfn, 4096 * 1024);
>  
>      if (-f $dstfn) {
> -        my $old = PVE::Tools::file_get_contents($dstfn, 1024 * 1024);
> +        my $old = PVE::Tools::file_get_contents($dstfn, 4096 * 1024);
>          return 0 if $new eq $old;
>      }
>  
> diff --git a/src/PMG/Report.pm b/src/PMG/Report.pm
> index 84d1b887..58756c77 100644
> --- a/src/PMG/Report.pm
> +++ b/src/PMG/Report.pm
> @@ -72,7 +72,7 @@ sub dir2text {
>          sub {
>              my ($file) = @_;
>              $report .= "\n# cat $target_dir$file\n";
> -            $report .= PVE::Tools::file_get_contents($target_dir . $file) . "\n";
> +            $report .= PVE::Tools::file_get_contents($target_dir . $file, 4096 * 1024) . "\n";
>          },
>      );
>  }





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH pmg-api v2] fix #7407: cluster: report: increase maximal filesize to 2M
  2026-03-16 12:12 [PATCH pmg-api v2] fix #7407: cluster: report: increase maximal filesize to 2M Stoiko Ivanov
  2026-03-16 12:17 ` Stoiko Ivanov
@ 2026-03-16 12:18 ` Shannon Sterz
  1 sibling, 0 replies; 3+ messages in thread
From: Shannon Sterz @ 2026-03-16 12:18 UTC (permalink / raw)
  To: Stoiko Ivanov; +Cc: pmg-devel

On Mon Mar 16, 2026 at 1:12 PM CET, Stoiko Ivanov wrote:
> the postfix configuration files are read via PVE::INotify in our
> stack and have not implicit limit.
>
> PMG::Cluster and PMG::Report do read the same file's contents using
> `file_get_contents` with a limit (explicitly set, or implicit) of 1M.
>
> This causes the cluster-sync to fail in one reported deployment
> hosting ~40k domains, with explicit transport entries and comments
> (resulting in a 1.4M /etc/pmg/transport).
>
> As it's the first occurrence of this causing an issue doubling the
> limit to 2M, instead of increasing it further seems appropriate.

nit: probably want to adapt this line and the subject if this requires a
v3 ;)

> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> v1->v2:
> * increase size to 4M based on feedback from Dominik - thx!
>
>  src/PMG/Cluster.pm | 4 ++--
>  src/PMG/Report.pm  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/PMG/Cluster.pm b/src/PMG/Cluster.pm
> index 02d727ee..3e0b12ac 100644
> --- a/src/PMG/Cluster.pm
> +++ b/src/PMG/Cluster.pm
> @@ -266,10 +266,10 @@ my $cond_commit_synced_file = sub {
>          return;
>      }
>
> -    my $new = PVE::Tools::file_get_contents($srcfn, 1024 * 1024);
> +    my $new = PVE::Tools::file_get_contents($srcfn, 4096 * 1024);
>
>      if (-f $dstfn) {
> -        my $old = PVE::Tools::file_get_contents($dstfn, 1024 * 1024);
> +        my $old = PVE::Tools::file_get_contents($dstfn, 4096 * 1024);
>          return 0 if $new eq $old;
>      }
>
> diff --git a/src/PMG/Report.pm b/src/PMG/Report.pm
> index 84d1b887..58756c77 100644
> --- a/src/PMG/Report.pm
> +++ b/src/PMG/Report.pm
> @@ -72,7 +72,7 @@ sub dir2text {
>          sub {
>              my ($file) = @_;
>              $report .= "\n# cat $target_dir$file\n";
> -            $report .= PVE::Tools::file_get_contents($target_dir . $file) . "\n";
> +            $report .= PVE::Tools::file_get_contents($target_dir . $file, 4096 * 1024) . "\n";
>          },
>      );
>  }





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-16 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-16 12:12 [PATCH pmg-api v2] fix #7407: cluster: report: increase maximal filesize to 2M Stoiko Ivanov
2026-03-16 12:17 ` Stoiko Ivanov
2026-03-16 12:18 ` Shannon Sterz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal