🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.current
16 messages
16 total messages Started by Poul-Henning Kamp Mon, 02 Nov 2026 11:25
Should we add jitter to cron(8) ?
#139
Author: Poul-Henning Kamp
Date: Mon, 02 Nov 2026 11:25
35 lines
4114 bytes
Embedded systems using cron(8) are starting to cause macroscopic
effects at the top of the minute:

	https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-solved

That indicates that we should add jitter to cron(8).

I can see three ways to do it:

A) By default cron(8) waits [0...N] seconds before executing commands.
   This can be disabled with a command line option.
   For a number of reasons which we can hash later, I suggest N=30

B) Same as A), but the command line option enables jitter.

C) Same as A), but with additional crontab(5) syntax to say "dont
   jitter this particular entry".

I would argue that A is the proper choice.

Comments ?

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#140
Author: Dmitry Salychev
Date: Mon, 02 Nov 2026 11:53
38 lines
3041 bytes
Poul-Henning Kamp <phk@phk.freebsd.dk> writes:

> Embedded systems using cron(8) are starting to cause macroscopic
> effects at the top of the minute:
>
> 	https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-solved
>
> That indicates that we should add jitter to cron(8).
>
> I can see three ways to do it:
>
> A) By default cron(8) waits [0...N] seconds before executing commands.
>    This can be disabled with a command line option.
>    For a number of reasons which we can hash later, I suggest N=30
>
> B) Same as A), but the command line option enables jitter.
>
> C) Same as A), but with additional crontab(5) syntax to say "dont
>    jitter this particular entry".
>
> I would argue that A is the proper choice.
>
> Comments ?

Sounds reasonable to me. I'm also in favor of the A, but would consider
even more conservative N=60 with a special release note stating cron(8)
behavior is changed by default and how to restore the old one.

Regards,
Dmitry

-- 
https://wiki.freebsd.org/DmitrySalychev


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#141
Author: Miroslav Lachman
Date: Mon, 02 Nov 2026 11:56
51 lines
5766 bytes
On 02/11/2026 12:25, Poul-Henning Kamp wrote:
> Embedded systems using cron(8) are starting to cause macroscopic
> effects at the top of the minute:
> 
> 	https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-solved
> 
> That indicates that we should add jitter to cron(8).
> 
> I can see three ways to do it:
> 
> A) By default cron(8) waits [0...N] seconds before executing commands.
>     This can be disabled with a command line option.
>     For a number of reasons which we can hash later, I suggest N=30
> 
> B) Same as A), but the command line option enables jitter.
> 
> C) Same as A), but with additional crontab(5) syntax to say "dont
>     jitter this particular entry".
> 
> I would argue that A is the proper choice.
> 
> Comments ?
We already have that. Or do you mean something else?

-j jitter
  Enable time jitter.  Prior to executing commands, cron will sleep
  a random number of seconds in the range from 0 to jitter.  This
  will not affect superuser jobs (see -J).  A value for jitter must
  be between 0 and 60 inclusive.  Default is 0, which effectively
  disables time jitter.

  This option can help to smooth down system load spikes during
  moments when a lot of jobs are likely to start at once, e.g., at
  the beginning of the first minute of each hour.

-J rootjitter
  Enable time jitter for superuser jobs.  The same as -j except
  that it will affect jobs run by the superuser only.


cron_flags="-j 20 -J 20" in rc.conf should do the trick


Best regards
Miroslav Lachman



--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#143
Author: Peter Jeremy
Date: Mon, 02 Nov 2026 12:38
81 lines
5282 bytes
--nhnXmbLRyn4T+jHt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2026-Nov-02 11:25:49 +0000, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
>Embedded systems using cron(8) are starting to cause macroscopic
>effects at the top of the minute:
>
>	https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-6=
0-second-fluctuations-in-power-grids-solved

An unwanted side-effect of precise time now being easily available
(and hence the default) everywhere :-).  There have been past issues
with synchronized wakeups from mobile phones causing network spikes.

>That indicates that we should add jitter to cron(8).

Agreed.

>I can see three ways to do it:
>
>A) By default cron(8) waits [0...N] seconds before executing commands.
>   This can be disabled with a command line option.
>   For a number of reasons which we can hash later, I suggest N=3D30
>
>B) Same as A), but the command line option enables jitter.
>
>C) Same as A), but with additional crontab(5) syntax to say "dont
>   jitter this particular entry".
>
>I would argue that A is the proper choice.

In the long term, I agree - I'd suggest that 16-RELEASE be either A or
C.  I'm not sure A could be MFC'd, though B definitely could be.

OTOH, I'm loath to suddenly make a significant change to cron
behaviour - I'm confident that there are systems somewhere that depend
on the current behaviour - which suggests that C should be
implemented.  Overall, I'd suggest implementing B to start with (so
jitter is optional) and MFC'ing it, then later flipping the default in
-CURRENT to A (and maybe implementing C if people find a need for it).

As a related issue, should we also come up with a cron syntax that
is less precise about when a task runs - currently the "@" variants
specify that they run at the start of whatever period is specified.
IMO, it would be useful to have a way of saying e.g. "run once an hour
but I don't care when within the hour".

--=20
Peter Jeremy

--nhnXmbLRyn4T+jHt
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQKvBAEBCgCZFiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAmrohFsbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwzXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFRUIyOTg2QzMwNjcxRTc0RTY1QzIy
N0UxNkE1OTdBMEU0QTIwQjM0AAoJEBall6Dkogs0AAIP/iuZlQbZNc+YCymvsinG
QvtmuXVf4J9pX6DPe53rVptsdGWo5Ndf5cOai/s9XdVoDi6lC1l/5kYTDS70rZYY
xGEiK29CTGHRCOCQsbiWqX+fYOQESU5o9DfFoBf2KfQsssTZAvjFxLoyMCZK4B0L
oU43D3iW0H7oWQXgBuZVO/nSa8rS7KugPS5h/I3DgRYLAnynXG2LI9WoAMtB59BJ
o+9ZgH8XuBtjIvdEZLHIBQ6dyqXj9gWBKwhqk29U105dLgGZdutsrC/OWn42nVhI
v+IN8bSmg7FO7u5nkCDq/r5NL4mIp/E6VRpDeNQ6aqSxJEcuFwypf8S2ml9ILmJ7
sn+UqlJwI5h0NjW8eU9ERjd3gz4cLf4J3t/sqCxrJM7fKUhbi94UEHO/hZqSxSFA
DHmd7ZXwsqTeLhD8JoiGkNlGsV0Is/FUGxzhMmF8KWebfgUCN1vGeJ78F/zcbC/z
Cd0ggy+yb14TY8leQZ7p73GhntmKY1a/e3vfj6gN9anvy12+Z6APz5fSQYc+tmhu
6ineZ8qlYvLmsWt/hbY4G0dYAoBAOutVJo+KNHdcN9kVGdZMExj+4rfWJT5lIBUG
+iStSRR96txAGeFikDZpn+ktkQ0arEvClvTFVqh3J22zHIvLmDAxiEq4dLA34gdv
HZPyHySxUU0nllCXcNhFmxSj
=v4e6
-----END PGP SIGNATURE-----

--nhnXmbLRyn4T+jHt--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#145
Author: Alexander Leidinger
Date: Mon, 02 Nov 2026 13:28
105 lines
7945 bytes
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)

--=_af53b1f6d4b03681ad802acfdeee5427
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII;
 format=flowed

Am 2026-11-02 12:56, schrieb Miroslav Lachman:
> On 02/11/2026 12:25, Poul-Henning Kamp wrote:
>> Embedded systems using cron(8) are starting to cause macroscopic
>> effects at the top of the minute:
>> 
>> 	https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-solved
>> 
>> That indicates that we should add jitter to cron(8).
>> 
>> I can see three ways to do it:
>> 
>> A) By default cron(8) waits [0...N] seconds before executing commands.
>>     This can be disabled with a command line option.
>>     For a number of reasons which we can hash later, I suggest N=30
>> 
>> B) Same as A), but the command line option enables jitter.
>> 
>> C) Same as A), but with additional crontab(5) syntax to say "dont
>>     jitter this particular entry".
>> 
>> I would argue that A is the proper choice.
>> 
>> Comments ?
> We already have that. Or do you mean something else?
> 
> -j jitter
>  Enable time jitter.  Prior to executing commands, cron will sleep
>  a random number of seconds in the range from 0 to jitter.  This
>  will not affect superuser jobs (see -J).  A value for jitter must
>  be between 0 and 60 inclusive.  Default is 0, which effectively
>  disables time jitter.
> 
>  This option can help to smooth down system load spikes during
>  moments when a lot of jobs are likely to start at once, e.g., at
>  the beginning of the first minute of each hour.
> 
> -J rootjitter
>  Enable time jitter for superuser jobs.  The same as -j except
>  that it will affect jobs run by the superuser only.
> 
> 
> cron_flags="-j 20 -J 20" in rc.conf should do the trick

Adding to that:
  - POLA (I can easily imagine how this breaks stuff, I paid attention on 
my system a time drift or load spike induced delay doesn't, but in 
general I would bet this can cause problems).
  - It always comes down to the choice of a human. I always try to 
schedule at random times and not at the usual suspects like "00" or 
multiples of 5 or 10.
  - Do we expect that those jobs use cron? Or asked differently: why do 
you think it will matter in the big picture?

By using A you enforce policy. In the past we didn't want to do that.

We already have B. There's also option D, having two new options: one to 
ensure jitter, and one to disable jitter. With B+D it's up to the admin 
to set the policy.

Bye,
Alexander.

-- 
http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF

--=_af53b1f6d4b03681ad802acfdeee5427
Content-Type: application/pgp-signature;
 name=signature.asc
Content-Disposition: attachment;
 filename=signature.asc;
 size=870
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQJPBAEBCAA5FiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmrokBcbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwzAAoJEBINsJsD+NiGxjoP/RzMG+xy+X7f+GmiCfC/
POkyT2Zjgs9ptvSfQuTbTQFU+UlcCvwMw68zZ1/VrQExHQjsjuhnyaVmynh4ewuZ
ZoRlajx7JK9nN5GTGRyGuOl2dpyy1vyX9/+2At60dqvAnAfBcELkz4f5vzxESMM6
KewwU/6c0wybpxfyr+BgIVwSIAHDGElOvW48Zpp0uYSI7bVagJJ3y48HuyypILZu
1Y7G5smEuSYFnhmsZrrgep+QQuF4R/YholGjKHRkOsV72s9i4C7K0TdoC3MWk2yN
HsXHZ/klRemgPyTndPjysU4ta7vawHDXKO01s1+lYHREfS0p5pAefOfNTnFNvuCp
cGqBPX8B8p+MByUxfDifjvAnwEYKbKqf4atTW25vsS7IMM0n7Lx6AgaZ76tdi2mX
2Cup6PgmEQtcyZNAIXVL/64jlbMxYFunwSANsZIcrampM1uq5OObiYgUn5S5sHJh
oFgd4q0Kq+LQQe97Cwtu54JyLtcQJUZkx2hUljEwWiQ+cXU6isoNiZ8Nw0dzoykM
3LAvC/U2KASCkLWld2EE+LkBk4JIkRPbk1Y9cT7xPGd8j55Up60gbuQDSzjyrHFg
I/cpcPUi873fnos7ICp77gZgHleAt0W0SiyLEsNWMwJof+xrQF9RlZbfvmLwBLoN
MHkzEloztoA60lvtqyUfY1ST
=z1XJ
-----END PGP SIGNATURE-----

--=_af53b1f6d4b03681ad802acfdeee5427--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#146
Author: Bob Bishop
Date: Mon, 02 Nov 2026 13:38
51 lines
4940 bytes
Hi,

> On 2 Nov 2026, at 11:25, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> 
> Embedded systems using cron(8) are starting to cause macroscopic
> effects at the top of the minute:
> 
> https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-solved
> 
> That indicates that we should add jitter to cron(8).
> 
> I can see three ways to do it:
> 
> A) By default cron(8) waits [0...N] seconds before executing commands.
>   This can be disabled with a command line option.
>   For a number of reasons which we can hash later, I suggest N=30
> 
> B) Same as A), but the command line option enables jitter.
> 
> C) Same as A), but with additional crontab(5) syntax to say "dont
>   jitter this particular entry".
> 
> I would argue that A is the proper choice.
> 
> Comments ?

I’d vote for C; you don’t want people like me turning the jitter off globally because one entry is time-critical.

> -- 
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
> 

--
Bob Bishop
rb@gid.co.uk






--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#148
Author: Bakul Shah
Date: Mon, 02 Nov 2026 15:06
38 lines
6848 bytes

> On Nov 2, 2026, at 3:25 AM, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> 
> Embedded systems using cron(8) are starting to cause macroscopic
> effects at the top of the minute:
> 
> https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-solved
> 
> That indicates that we should add jitter to cron(8).
> 
> I can see three ways to do it:
> 
> A) By default cron(8) waits [0...N] seconds before executing commands.
>   This can be disabled with a command line option.
>   For a number of reasons which we can hash later, I suggest N=30
> 
> B) Same as A), but the command line option enables jitter.
> 
> C) Same as A), but with additional crontab(5) syntax to say "dont
>   jitter this particular entry".
> 
> I would argue that A is the proper choice.
> 
> Comments ?

We can add a cron_flags="-s -j 30 -J 30" to /etc/defaults/rc.conf.

I suspect the % of embedded FreeBSD systems is rather low to matter.
Embedded Linux & various RTOSes will do their own thing in any case.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#150
Author: Jamie Landeg-Jones
Date: Mon, 02 Nov 2026 17:05
22 lines
3997 bytes
Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:

> A) By default cron(8) waits [0...N] seconds before executing commands.
>    This can be disabled with a command line option.
>    For a number of reasons which we can hash later, I suggest N=30
>
> B) Same as A), but the command line option enables jitter.
>
> C) Same as A), but with additional crontab(5) syntax to say "dont
>    jitter this particular entry".
>
> I would argue that A is the proper choice.

For years I've been running cron on my FreeBSD servers with:  /usr/sbin/cron -j 10 -J 10 -s
An option to disable it for specific jobs would be handy though.

Cheers, Jamie


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#151
Author: Jamie Landeg-Jones
Date: Mon, 02 Nov 2026 17:10
17 lines
3731 bytes
Peter Jeremy <peterj@FreeBSD.org> wrote:

> IMO, it would be useful to have a way of saying e.g. "run once an hour
> but I don't care when within the hour".

I assume that the time within the hour would be the same each hour? If so,
that would be useful.

But would than initial state random number be stored somewhere, or reset
each time cron starts?

Cheers, Jamie


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#152
Author: Don Lewis
Date: Mon, 02 Nov 2026 18:27
20 lines
2491 bytes
On  2 Nov, Jamie Landeg-Jones wrote:
> Peter Jeremy <peterj@FreeBSD.org> wrote:
> 
>> IMO, it would be useful to have a way of saying e.g. "run once an hour
>> but I don't care when within the hour".
> 
> I assume that the time within the hour would be the same each hour? If so,
> that would be useful.
> 
> But would than initial state random number be stored somewhere, or reset
> each time cron starts?

... and if cron gets restarted, could the job get run twice in that
hour?



--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#153
Author: Enji Cooper (yaneurabeya)
Date: Mon, 02 Nov 2026 18:28
67 lines
8264 bytes
--Apple-Mail=_83E217A6-8310-416C-9197-4A805BE481C4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Nov 2, 2026, at 9:10=E2=80=AFAM, Jamie Landeg-Jones =
<jamie@catflap.org> wrote:
>=20
> Peter Jeremy <peterj@FreeBSD.org> wrote:
>=20
>> IMO, it would be useful to have a way of saying e.g. "run once an =
hour
>> but I don't care when within the hour".
>=20
> I assume that the time within the hour would be the same each hour? If =
so,
> that would be useful.
>=20
> But would than initial state random number be stored somewhere, or =
reset
> each time cron starts?

<2 cents> (deflated)
It would probably be better if the state was tracked at the system level =
instead of in the application itself.

As a bonus, employing jitter might improve overall system-level entropy, =
depending on how jobs are run and when, which could help cryptography =
some.
</2 cents>

Thanks,
-Enji=

--Apple-Mail=_83E217A6-8310-416C-9197-4A805BE481C4
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmro1jkACgkQGpE5DjPs
NJjNkQ/+PrOXSLLAQSbDLGZJjJOCWLkuvNRVAodHqV7cnnCXvyFPZocuolWQJK+j
xTiFL627foMN7zfWvicDFuq30ThGhsmGvADLujmLZPZNfVsI4bfIvJSUXdvMQINy
nprSMwrOqPGBtPH/IXAmQ9p6DHDNuvLGuDj+epZ/HmY0qqWIdnkrG4Uzr8Qo5VYV
vwkeSrpFeozeukfmgxKx/hWxo/qCHNQVgnUkC3LxSL1QCgdKNAw5OTOsWO7RDQQj
xOArrM4ZHZdOjw5IH7p0TTMeeNGi48PY0eKyGzuXYSsY0rj0Km76q2ATGbEINMa+
/bpPBVg8EwKFE9wPSqQ9EiCptfxsVpPb4vKb/Hp9FI+hUVc3zVTCSHO1M5p/9kNx
5qmNcfNxbu7s8WCgTM7HHAxdeaAclzofiPXUAU250HbrZWDXgJ1Nw4LNmDV0Ifqu
mJjUWA5rW1IPp6NtQiqaYN2gFmA2dqCL6vMboV7+mGPiCIHTXzjUkUdh4hLOx9ux
IQna6eOT0LjFaWFSpTNcKeCD0d3cUlOE8UzFcg3UsIyD/jKQegd0nr6ZmPA+/wLE
lX9+pHm4fZ5S7Imh4TFu/aWgvjYB8rsjxJHsrg4Xx7vV3tYkIauIaqN6t8BRzK1q
RGFS00Eb5P9vKwgPipHbBcJVzjQ/CAC6IzFXsEqtRNwjJXOk1y8=
=2uEi
-----END PGP SIGNATURE-----

--Apple-Mail=_83E217A6-8310-416C-9197-4A805BE481C4--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#154
Author: Warner Losh
Date: Mon, 02 Nov 2026 18:38
105 lines
9553 bytes
--0000000000005e9ec3065f4f7458
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Nov 2, 2026 at 4:26=E2=80=AFAM Poul-Henning Kamp <phk@phk.freebsd.d=
k> wrote:

> Embedded systems using cron(8) are starting to cause macroscopic
> effects at the top of the minute:
>
>
> https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-6=
0-second-fluctuations-in-power-grids-solved
>
> That indicates that we should add jitter to cron(8).
>
> I can see three ways to do it:
>
> A) By default cron(8) waits [0...N] seconds before executing commands.
>    This can be disabled with a command line option.
>    For a number of reasons which we can hash later, I suggest N=3D30
>
> B) Same as A), but the command line option enables jitter.
>
> C) Same as A), but with additional crontab(5) syntax to say "dont
>    jitter this particular entry".
>
> I would argue that A is the proper choice.
>
> Comments ?
>

I'd argue A is the proper choice, but when there's N to run in the same
minute we run them in the same order as before and the jitter just hits the
first one.

Warner


> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetenc=
e.
>
>

--0000000000005e9ec3065f4f7458
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g=
mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Nov 2, =
2026 at 4:26=E2=80=AFAM Poul-Henning Kamp &lt;<a href=3D"mailto:phk@phk.fre=
ebsd.dk">phk@phk.freebsd.dk</a>&gt; wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex">Embedded systems using cron(8) are starting to c=
ause macroscopic<br>
effects at the top of the minute:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"https://www.fz-juelich.de/en/news/ar=
chive/press-release/2026/mystery-of-60-second-fluctuations-in-power-grids-s=
olved" rel=3D"noreferrer" target=3D"_blank">https://www.fz-juelich.de/en/ne=
ws/archive/press-release/2026/mystery-of-60-second-fluctuations-in-power-gr=
ids-solved</a><br>
<br>
That indicates that we should add jitter to cron(8).<br>
<br>
I can see three ways to do it:<br>
<br>
A) By default cron(8) waits [0...N] seconds before executing commands.<br>
=C2=A0 =C2=A0This can be disabled with a command line option.<br>
=C2=A0 =C2=A0For a number of reasons which we can hash later, I suggest N=
=3D30<br>
<br>
B) Same as A), but the command line option enables jitter.<br>
<br>
C) Same as A), but with additional crontab(5) syntax to say &quot;dont<br>
=C2=A0 =C2=A0jitter this particular entry&quot;.<br>
<br>
I would argue that A is the proper choice.<br>
<br>
Comments ?<br></blockquote><div><br></div><div>I&#39;d argue A is the prope=
r=C2=A0choice, but when there&#39;s N to run in the same minute we run them=
 in the same order as before and the jitter just hits the first one.</div><=
div><br></div><div>Warner</div><div>=C2=A0</div><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
204);padding-left:1ex">
-- <br>
Poul-Henning Kamp=C2=A0 =C2=A0 =C2=A0 =C2=A0| UNIX since Zilog Zeus 3.20<br=
>
phk@FreeBSD.ORG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| TCP/IP since RFC 956<br>
FreeBSD committer=C2=A0 =C2=A0 =C2=A0 =C2=A0| BSD since 4.3-tahoe<br>
Never attribute to malice what can adequately be explained by incompetence.=
<br>
<br>
</blockquote></div></div>

--0000000000005e9ec3065f4f7458--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#155
Author: Sulev-Madis Silber
Date: Mon, 02 Nov 2026 18:58
40 lines
5654 bytes

On November 2, 2026 8:28:09 PM GMT+02:00, "Enji Cooper (yaneurabeya)" <yaneurabeya@gmail.com> wrote:
>
>> On Nov 2, 2026, at 9:10 AM, Jamie Landeg-Jones <jamie@catflap.org> wrote:
>> 
>> Peter Jeremy <peterj@FreeBSD.org> wrote:
>> 
>>> IMO, it would be useful to have a way of saying e.g. "run once an hour
>>> but I don't care when within the hour".
>> 
>> I assume that the time within the hour would be the same each hour? If so,
>> that would be useful.
>> 
>> But would than initial state random number be stored somewhere, or reset
>> each time cron starts?
>
><2 cents> (deflated)
>It would probably be better if the state was tracked at the system level instead of in the application itself.
>
>As a bonus, employing jitter might improve overall system-level entropy, depending on how jobs are run and when, which could help cryptography some.
></2 cents>
>
>Thanks,
>-Enji

what if (embedded) system with read-only filesystem reboots?


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#158
Author: Enji Cooper (yaneurabeya)
Date: Mon, 02 Nov 2026 23:59
78 lines
8607 bytes
--Apple-Mail=_8B72B468-FBB9-4199-827D-048A8D356C42
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Nov 2, 2026, at 10:58=E2=80=AFAM, Sulev-Madis Silber =
<freebsd-current-freebsd-org111@ketas.si.pri.ee> wrote:
>=20
> On November 2, 2026 8:28:09 PM GMT+02:00, "Enji Cooper (yaneurabeya)" =
<yaneurabeya@gmail.com> wrote:
>>=20
>>> On Nov 2, 2026, at 9:10=E2=80=AFAM, Jamie Landeg-Jones =
<jamie@catflap.org> wrote:
>>>=20
>>> Peter Jeremy <peterj@FreeBSD.org> wrote:
>>>=20
>>>> IMO, it would be useful to have a way of saying e.g. "run once an =
hour
>>>> but I don't care when within the hour".
>>>=20
>>> I assume that the time within the hour would be the same each hour? =
If so,
>>> that would be useful.
>>>=20
>>> But would than initial state random number be stored somewhere, or =
reset
>>> each time cron starts?
>>=20
>> <2 cents> (deflated)
>> It would probably be better if the state was tracked at the system =
level instead of in the application itself.
>>=20
>> As a bonus, employing jitter might improve overall system-level =
entropy, depending on how jobs are run and when, which could help =
cryptography some.
>> </2 cents>
>>=20
>> Thanks,
>> -Enji
>=20
> what if (embedded) system with read-only filesystem reboots?

Wouldn=E2=80=99t that suffer the same issues as cron-saved entropy data?
-Enji=

--Apple-Mail=_8B72B468-FBB9-4199-827D-048A8D356C42
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmrpJAAACgkQGpE5DjPs
NJiXiA/8CBJRYfTCF/SK0SbaLsVLs4n5zhq2nkup7mpYTxyqrFCQqzYaZcXb7W7C
h80KSxexYhvt7JvH9Oq9d/xAFZ+LgmDqzv3NaIFyzUuFcDB7f07WE/upIX9onrGI
y5uQ2aLYhEfSFaTVj2TrlI0jHPUVMX90IJ/wxeiQ7ssF9uhdjArEvojheCW0Y8ZO
aH230PgFrnnTCfShR0TAbxIHqQYazFBe+95Zr7SBN0qBdR5+9rq+uUkBXnkcSp1e
EhthDNxhiOGTgzjs/MkcQWoeJKkyfc1uonDkYRMMpQdJrg2YYr17Bp6shUWJrkX+
acZzhYBHEqBY2Uv8mdK1W4G4Q/E1R5fgDABfnfCoPUts5MPubbln9lTZjhVKm3nt
3s3fN8ifIyYBRu6sFxL1KvTQGcDoII+IJKSBTmS9fnSBrnzam1pfRt3Hhiig3TiJ
s8oWMIbnbQElby1jpllL3Ya/aBEVtIwMIw2nVmOlJIIj2+IS0y7S6m6a0tdVURsr
32MHMMLMw4SO6i6OzSYxbT9Xky6KSjmirp7pOsoBD2TzbToJ56RmCef4fikd8tGn
847bfXI+3y+NmtOPHiOmV/kWzZzt7agiJUJiT1XgVIrPLd9z9GO9Y3Jsfdfvtw94
kk5rS+7CvirwWLTe5jMDHmqgETWY+jsAseNlJAKt/9EPTcLshkI=
=aNn9
-----END PGP SIGNATURE-----

--Apple-Mail=_8B72B468-FBB9-4199-827D-048A8D356C42--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#162
Author: Ronald Klop
Date: Tue, 03 Nov 2026 11:56
105 lines
7390 bytes
------=_Part_1203_979822255.1793706969358
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Van: Don Lewis <truckman@FreeBSD.org>
Datum: maandag, 2 november 2026 19:27
Aan: Jamie Landeg-Jones <jamie@catflap.org>
CC: phk@phk.freebsd.dk, peterj@FreeBSD.org, current@FreeBSD.org
Onderwerp: Re: Should we add jitter to cron(8) ?
> 
> On  2 Nov, Jamie Landeg-Jones wrote:
> > Peter Jeremy <peterj@FreeBSD.org> wrote:
> >
> >> IMO, it would be useful to have a way of saying e.g. "run once an hour
> >> but I don't care when within the hour".
> >
> > I assume that the time within the hour would be the same each hour? If so,
> > that would be useful.
> >
> > But would than initial state random number be stored somewhere, or reset
> > each time cron starts?
> 
> ... and if cron gets restarted, could the job get run twice in that
> hour?
> 
>  
> 
> 
> 


Some inspirational thoughts.

OpenBSD already has a notation for random (~) in their crontab definition.
https://man.openbsd.org/crontab.5

And Jenkins (the CI/CD tool) can use a hash to get some "stable random" number for scheduling jobs.
"The H symbol can be thought of as a random value over a range, but it actually is a hash of the job name, not a random function, so that the value remains stable for any given project."
Examples like: H H(0-7) * * * or H/3, @hourly becomes H * * * *.

Regards,
Ronald.
 
------=_Part_1203_979822255.1793706969358
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<br />
<p><strong>Van:</strong> Don Lewis &lt;truckman@FreeBSD.org&gt;<br />
<strong>Datum:</strong> maandag, 2 november 2026 19:27<br />
<strong>Aan:</strong> Jamie Landeg-Jones &lt;jamie@catflap.org&gt;<br />
<strong>CC:</strong> phk@phk.freebsd.dk, peterj@FreeBSD.org, current@FreeBS=
D.org<br />
<strong>Onderwerp:</strong> Re: Should we add jitter to cron(8) ?</p>

<blockquote style=3D"padding-right: 0px; padding-left: 5px; margin-left: 5p=
x; border-left: #000000 2px solid; margin-right: 0px">
<div class=3D"MessageRFC822Viewer" id=3D"P">
<div class=3D"TextPlainViewer" id=3D"P.P">On &nbsp;2 Nov, Jamie Landeg-Jone=
s wrote:<br />
&gt; Peter Jeremy &lt;peterj@FreeBSD.org&gt; wrote:<br />
&gt;<br />
&gt;&gt; IMO, it would be useful to have a way of saying e.g. "run once an =
hour<br />
&gt;&gt; but I don't care when within the hour".<br />
&gt;<br />
&gt; I assume that the time within the hour would be the same each hour? If=
 so,<br />
&gt; that would be useful.<br />
&gt;<br />
&gt; But would than initial state random number be stored somewhere, or res=
et<br />
&gt; each time cron starts?<br />
<br />
... and if cron gets restarted, could the job get run twice in that<br />
hour?<br />
<br />
=C2=A0</div>

<hr /></div>
</blockquote>
<br />
<br />
Some inspirational thoughts.<br />
<br />
OpenBSD already has a notation for random (~) in their crontab definition.<=
br />
https://man.openbsd.org/crontab.5<br />
<br />
And Jenkins (the CI/CD tool) can use a hash to get some "stable random" num=
ber for scheduling jobs.<br />
"The <code>H</code> symbol can be thought of as a random value over a range=
, but it actually is a hash of the job name, not a random function, so that=
 the value remains stable for any given project."<br />
Examples like: H H(0-7) * * * or H/3, @hourly becomes H * * * *.<br />
<br />
Regards,<br />
Ronald.<br />
=C2=A0
------=_Part_1203_979822255.1793706969358--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: Should we add jitter to cron(8) ?
#163
Author: Sulev-Madis Silber
Date: Tue, 03 Nov 2026 12:16
65 lines
6897 bytes

On November 3, 2026 1:59:59 AM GMT+02:00, "Enji Cooper (yaneurabeya)" <yaneurabeya@gmail.com> wrote:
>
>> On Nov 2, 2026, at 10:58 AM, Sulev-Madis Silber <freebsd-current-freebsd-org111@ketas.si.pri.ee> wrote:
>> 
>> On November 2, 2026 8:28:09 PM GMT+02:00, "Enji Cooper (yaneurabeya)" <yaneurabeya@gmail.com> wrote:
>>> 
>>>> On Nov 2, 2026, at 9:10 AM, Jamie Landeg-Jones <jamie@catflap.org> wrote:
>>>> 
>>>> Peter Jeremy <peterj@FreeBSD.org> wrote:
>>>> 
>>>>> IMO, it would be useful to have a way of saying e.g. "run once an hour
>>>>> but I don't care when within the hour".
>>>> 
>>>> I assume that the time within the hour would be the same each hour? If so,
>>>> that would be useful.
>>>> 
>>>> But would than initial state random number be stored somewhere, or reset
>>>> each time cron starts?
>>> 
>>> <2 cents> (deflated)
>>> It would probably be better if the state was tracked at the system level instead of in the application itself.
>>> 
>>> As a bonus, employing jitter might improve overall system-level entropy, depending on how jobs are run and when, which could help cryptography some.
>>> </2 cents>
>>> 
>>> Thanks,
>>> -Enji
>> 
>> what if (embedded) system with read-only filesystem reboots?
>
>Wouldn’t that suffer the same issues as cron-saved entropy data?
>-Enji

side question: are ro systems more insecure or it still gets enough seed for csprng on nowadays hw? and are rw systems less secure in first boot? we no longer require user to write screen full of chars at boot. does it matter if we save it over boots? or it's still fine if live collected. i'm not familiar with this subject

but as for cron, yeah no idea what will happen then, will it run multiple times? how do you know if task has been ran if it's supposed to run some time inside hour

oh and then comes the cursed cron @reboot which is so useful to start stuff but won't run at reboot at all, rather every cron restart. granted, most of machines run cron from boot to halt in one go, but things happen. one could save it if you can, works even with tmpfs /var/run, but then what if it's bad


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads