Re: error: Open connections exceed FD_SETSIZE limit (1024 >= 1024)

Nick Anderson <[email protected]> Thu, 13 Nov 2025 10:47:20 -0800 (PST)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
------=_Part_5092_2118582407.1763059640544
Content-Type: multipart/alternative; 
	boundary="----=_Part_5093_458548401.1763059640544"

------=_Part_5093_458548401.1763059640544
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Humm, this is on Ubuntu?

How many hosts are you copying from in this way? I wonder if you could=20
slice up your list and make multiple methods calls for the bundle one for=
=20
each section of the list.

You said switching to list allowed other policies to continue, they didn't=
=20
have issues with further file-copies (or maybe don't make any more)?

Devs say that's a compile time setting.

On Thursday, November 13, 2025 at 2:42:33=E2=80=AFAM UTC-6 Markus Rexhepi-L=
indberg=20
wrote:

> Hi Nick,
>
> Thanks for the suggestion to change from $ to @ when referencing the list=
=20
> of clients. This helped in the way that rest of the promises get to run=
=20
> even if FD_SETSIZE is being hit by the cf-agent process.
>
> I forgot to mention it but I did try altering the=20
> control_agent_maxconnections variable via augments but I did not see any=
=20
> difference. Thanks for updating the documentation though!
>
> Is FD_SETSIZE a limitation in the cf-agent program itself perhaps? While=
=20
> looking at the core source (with my VERY limited C knowledge) it seems th=
at=20
> the select function is used in the TryConnect function [1] which to my=20
> understanding has a limitation of 1024 file descriptors. I noticed the 19=
53=20
> pull request [2] which suggested to change select() to poll() instead but=
=20
> was ultimately closed due to Windows not supporting poll().
>
> [1]=20
> https://github.com/cfengine/core/blob/e639010a9d2453ed7d8559fb9f15d78b65e=
bfb52/libcfnet/net.c#L615
> [2] https://github.com/cfengine/core/pull/1953
> On Wednesday, November 12, 2025 at 6:40:42=E2=80=AFPM UTC+1=20
> [email protected] wrote:
>
>> Hey Markus,=20
>>
>> The first thing that jumped out at me from above was how you call your=
=20
>> bundle to copy the file:=20
>>
>> methods:
>>   "any" usebundle =3D> filecollector("$(cf_clients)"),
>>      action =3D> silent_sometimes;
>>
>> You reference the list of clients with $. So, the bundle will be=20
>> actuated once for each client. Have you instead tried passing the list s=
o=20
>> that the bundle is called just once and the iteration on the client happ=
ens=20
>> inside the bundle?=20
>>
>> Like:=20
>>
>> methods:
>>   "any" usebundle =3D> filecollector("@(cf_clients)"),
>>      action =3D> silent_sometimes;
>>
>> Regarding the maximum number of connections, I see that you mention=20
>> setting control_server_maxconnections, note that variable is used by=20
>> body server control (cf-serverd). For your policy, where you have one ag=
ent=20
>> that is creating a bunch of connections from cf-agent you might consider=
=20
>> setting default:def.control_agent_maxconnections. It's set to 30 in the=
=20
>> MPF by default.=20
>>
>> I would link you to the docs that mention it, but it doesn't seem to be=
=20
>> explicitly called out yet so I just filed an issue about it here=20
>> https://northerntech.atlassian.net/browse/CFE-4602=20
>>
>

--=20
You received this message because you are subscribed to the Google Groups "=
help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/help-cfengi=
ne/712e9074-3c91-48f5-b796-d4158b78aad2n%40googlegroups.com.

------=_Part_5093_458548401.1763059640544
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>Humm, this is on Ubuntu?</div><div><br /></div><div>How many hosts are=
 you copying from in this way? I wonder if you could slice up your list and=
 make multiple methods calls for the bundle one for each section of the lis=
t.</div><div><br /></div><div>You said switching to list allowed other poli=
cies to continue, they didn't have issues with further file-copies (or mayb=
e don't make any more)?</div><div><br /></div><div>Devs say that's a compil=
e time setting.</div><div><br /></div><div class=3D"gmail_quote"><div dir=
=3D"auto" class=3D"gmail_attr">On Thursday, November 13, 2025 at 2:42:33=E2=
=80=AFAM UTC-6 Markus Rexhepi-Lindberg wrote:<br/></div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-left: 1px solid rgb(2=
04, 204, 204); padding-left: 1ex;">Hi Nick,<br><br>Thanks for the suggestio=
n to change from $ to @ when referencing the list of clients. This helped i=
n the way that rest of the promises get to run even if FD_SETSIZE is being =
hit by the cf-agent process.<br><br>I forgot to mention it but I did try al=
tering the control_agent_maxconnections variable via augments but I did not=
 see any difference. Thanks for updating the documentation though!<br><br>I=
s=C2=A0FD_SETSIZE a limitation in the cf-agent program itself perhaps? Whil=
e looking at the core source (with my VERY limited C knowledge) it seems th=
at the select function is used in the TryConnect function [1] which to my u=
nderstanding has a limitation of 1024 file descriptors. I noticed the 1953 =
pull request [2] which suggested to change select() to poll() instead but w=
as ultimately closed due to Windows not supporting poll().<br><br>[1]=C2=A0=
<a href=3D"https://github.com/cfengine/core/blob/e639010a9d2453ed7d8559fb9f=
15d78b65ebfb52/libcfnet/net.c#L615" target=3D"_blank" rel=3D"nofollow" data=
-saferedirecturl=3D"https://www.google.com/url?hl=3Den&amp;q=3Dhttps://gith=
ub.com/cfengine/core/blob/e639010a9d2453ed7d8559fb9f15d78b65ebfb52/libcfnet=
/net.c%23L615&amp;source=3Dgmail&amp;ust=3D1763145644074000&amp;usg=3DAOvVa=
w3iElpK9rGwg10gQpW8PuMI">https://github.com/cfengine/core/blob/e639010a9d24=
53ed7d8559fb9f15d78b65ebfb52/libcfnet/net.c#L615</a><br>[2]=C2=A0<a href=3D=
"https://github.com/cfengine/core/pull/1953" target=3D"_blank" rel=3D"nofol=
low" data-saferedirecturl=3D"https://www.google.com/url?hl=3Den&amp;q=3Dhtt=
ps://github.com/cfengine/core/pull/1953&amp;source=3Dgmail&amp;ust=3D176314=
5644074000&amp;usg=3DAOvVaw0peQ_xWm8GncchBxcUNuHG">https://github.com/cfeng=
ine/core/pull/1953</a><div class=3D"gmail_quote"><div dir=3D"auto" class=3D=
"gmail_attr">On Wednesday, November 12, 2025 at 6:40:42=E2=80=AFPM UTC+1 ni=
[email protected] wrote:<br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef=
t:1ex"><p>
Hey Markus,
</p>

<p>
The first thing that jumped out at me from above was how you call your bund=
le to copy the file:
</p>

<div>
<pre><span style=3D"color:#a89984;font-weight:bold">methods</span>:
  <span style=3D"color:#689d6a">&quot;any&quot;</span> usebundle =3D&gt; fi=
lecollector<span style=3D"color:#689d6a">(</span><span style=3D"color:#689d=
6a">&quot;$(cf_clients)&quot;</span><span style=3D"color:#689d6a">)</span>,
     action =3D&gt; silent_sometimes;
</pre>
</div>
<p>
You reference the list of clients with <code>$</code>. So, the bundle will =
be actuated once for each client. Have you instead tried passing the list s=
o that the bundle is called just once and the iteration on the client happe=
ns inside the bundle?
</p>

<p>
Like:
</p>

<div>
<pre><span style=3D"color:#a89984;font-weight:bold">methods</span>:
  <span style=3D"color:#689d6a">&quot;any&quot;</span> usebundle =3D&gt; fi=
lecollector<span style=3D"color:#689d6a">(</span><span style=3D"color:#689d=
6a">&quot;@(cf_clients)&quot;</span><span style=3D"color:#689d6a">)</span>,
     action =3D&gt; silent_sometimes;
</pre>
</div>

<p>
Regarding the maximum number of connections, I see that you mention setting=
 <code>control_server_maxconnections</code>, note that variable is used by =
body server control (cf-serverd). For your policy, where you have one agent=
 that is creating a bunch of connections from cf-agent you might consider s=
etting <code>default:def.control_agent_maxconnections</code>. It&#39;s set =
to 30 in the MPF by default.
</p>

<p>
I would link you to the docs that mention it, but it doesn&#39;t seem to be=
 explicitly called out yet so I just filed an issue about it here <a href=
=3D"https://northerntech.atlassian.net/browse/CFE-4602" rel=3D"nofollow" ta=
rget=3D"_blank" data-saferedirecturl=3D"https://www.google.com/url?hl=3Den&=
amp;q=3Dhttps://northerntech.atlassian.net/browse/CFE-4602&amp;source=3Dgma=
il&amp;ust=3D1763145644074000&amp;usg=3DAOvVaw2j8feE0vu-zNkh28aL8N2K">https=
://northerntech.atlassian.net/browse/CFE-4602</a>
</p>
</blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;help-cfengine&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">help-=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
help-cfengine/712e9074-3c91-48f5-b796-d4158b78aad2n%40googlegroups.com?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/help-=
cfengine/712e9074-3c91-48f5-b796-d4158b78aad2n%40googlegroups.com</a>.<br /=
>

------=_Part_5093_458548401.1763059640544--

------=_Part_5092_2118582407.1763059640544--