Support setpriority

Bug #1577520 reported by Sergio Schvezov
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Snappy
Fix Released
Undecided
Jamie Strandboge
htop-snap
Fix Released
Undecided
Maximiliano Bertacchini

Bug Description

seccomp blocks setpriority making electron based apps unusable

Revision history for this message
Jamie Strandboge (jdstrand) wrote :
Changed in snappy:
status: New → Confirmed
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Or ERRNO instead of KILL. Think that's a long way off?

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

ERRNO instead of KILL is a separate thing that will come but will require upstream kernel changes (and therefore also backports to our reference and vendor kernels).

Changed in snappy:
status: Confirmed → In Progress
assignee: nobody → Jamie Strandboge (jdstrand)
Revision history for this message
Evan (ev) wrote :

This is also needed by Cassandra, which uses thread priorities to keep periodic tasks from taking precedence over its core workload:

https://github.com/evandandrea/cassandra-snap/commit/c47a44402ccb03abaecf4ae9474cd22c2661efd5

Revision history for this message
Daniel Manrique (roadmr) wrote :

I was able to circumvent this by patching the source code I was snapping to comment out one nice() call. This was feasible since it was just that one call, but may not be so easy for more complex software. This was done in the gnuchess snap (in the store), for the xboard part which tries to nice() the chess engine.

Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 1577520] Re: Support setpriority

Good catch, seems reasonable and a very easy interface to add, patch
welcome!

Mark

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Snaps will be able to set their own priority to positive nice values by default once snap-confine >= 1.0.34 (already released upstream) is available in the various distros and snapd can start using the feature. AIUI, people are working to land this in Ubuntu now.

Revision history for this message
Mark Shuttleworth (sabdfl) wrote :

Ah, thats a nice outcome :)

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

@Mark, on a related note, you mentioning adding an interface gave me the idea that we could add a 'process-control' (or something) interface that would allow, for example, htop to renice any process to any nice value as well as sending arbitrary signals to arbitrary processes. A powerful interface to be sure, but a useful one for a management snap. I've added a card to pursue this with the interfaces team.

Revision history for this message
Mark Shuttleworth (sabdfl) wrote :

Great thinking Jamie, thank you!

Mark

Revision history for this message
Olivier Tilloy (osomon) wrote :

This is also needed by oxide (web engine based on chromium).

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

FYI, process-control interface is now merged in trunk (this is bug https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1598225).

Changed in snappy:
status: In Progress → Fix Committed
status: Fix Committed → In Progress
Changed in snappy:
status: In Progress → Fix Committed
status: Fix Committed → In Progress
Revision history for this message
Evan (ev) wrote :

Marking this as fixed. process-control has landed in a released version of snapd.

Changed in snappy:
status: In Progress → Fix Released
Revision history for this message
Evan (ev) wrote :

And thanks Jamie! It helped with Cassandra and we've had a recent surge in Electron apps where it's also proven useful :)

Changed in htop-snap:
status: New → Fix Released
assignee: nobody → Maximiliano Bertacchini (maxiberta)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I've been trying to snap an electron app as per these changes, but I still see this setpriority call being blocked:

type=1326 audit(1477696911.141:2201): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=32160 comm="electron" exe="/snap/electron-quick-start/x1/lib/node_modules/electron/dist/electron" sig=31 arch=c000003e syscall=141 compat=0 ip=0x7fe0610a74a7 code=0x0

And I don't see any change by using the 'process-control' plug, is there anything missing?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Oh, sorry... I noticed I had to connect the plug/slots manually with:

 - sudo snap connect electron-quick-start:process-control ubuntu-core:process-control

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

FYI, while the addition of the 'process-control' interface fixed this for people, snapd 2.23 will have changes in the default template that will allow certain uses of setpriority to work without process-control (specifically, when using (setpriority(PRIO_PROCESS, 0, 0-19), which is a common use case). For the other uses, process-control is of course still available to use.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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