run-this-one is very slow

Bug #1917157 reported by Sven Hartrumpf
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
run-one (Ubuntu)
Triaged
Low
Unassigned

Bug Description

All invocations of run-this-one are slowed down massively (since Ubuntu 20.04, also in Ubuntu 20.10). Example:

time run-this-one echo

real 1,902s user 1,216s syst 0,182s busy 73,47%

The slow down depends on the stack size of your shell. So, this is probably caused by the pgrep call for run-this-one (see Ubuntu bug #1874824 ). As the 1y-old upstream fix for bug #1874824 is not applied to the Ubuntu packages, could run-one avoid pgrep calls?

tags: added: focal groovy hirsute
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I can reproduce this. I quickly instrumented run-this-one to see why it takes time. The pgrep took 5.4ms, so avoiding the pgrep won't help. The lsof call took 1376ms, so that's where most of the delay is. There's also a "sleep 0.5" in there. The sleep together with the lsof account for most of the time.

Suggestions welcome.

I'm marking Importance: Low since I can't imagine a use case where this would cause a real practical impact to Ubuntu users. If you're affected more severely, please explain your use case.

Changed in run-one (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Sven Hartrumpf (hartrumpf) wrote :

Thanks for such a quick and helpful response.

Which Ubuntu version did you try and which stack limits?

Revision history for this message
Robie Basak (racb) wrote :

Thanks. We try!

I used a Bionic lxd container on a Hirsute host machine, with whatever the default is for limits.

Revision history for this message
Sven Hartrumpf (hartrumpf) wrote :

There are many programming languages where some frequent programming patterns (like non tail recursion) use more stack than the default of 8192. People normally increase the stack limit in such cases, e.g.

 # ulimit -S -s 800000

The run time increase is linear in stack limit:

 # time run-this-one echo

real 3,763s user 3,012s syst 0,249s busy 86,65%
real 6,954s user 6,028s syst 0,425s busy 92,78% (with doubled stack limit)

Or even:

 # ulimit -S -s unlimited
 # time run-this-one echo
pgrep: cannot allocate 4611686018427387903 bytes

real 0,658s user 0,071s syst 0,076s busy 22,31%

Revision history for this message
Robie Basak (racb) wrote :

OK, so we should fix pgrep to fix that. There's little sense in working around it when we can just patch pgrep in Ubuntu. You have bug 1874824 for that.

Revision history for this message
Sven Hartrumpf (hartrumpf) wrote :

Sure, fixing the pgrep bug will be the easiest solution for run-this-one and others. Thanks for your help on bug 1878424.

Let's hope it will be in 21.04 and maybe even backported.

Revision history for this message
Sven Hartrumpf (hartrumpf) wrote :

I meant bug 1874824.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.