the gox classic snap gets stuck consuming a lot of cpu

Bug #1673186 reported by Leo Arias
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Confirmed
Undecided
Unassigned
snapd
Invalid
Undecided
Unassigned

Bug Description

I'm trying to make a snap for gox: https://github.com/mitchellh/gox

It needs to call the go binary installed in the system, so I made it classic. Attached is the yaml to make the snap. Build it with snapcraft, install it with --classic and:

$ taskset 2 gox -h

(taskset to avoid the bug with multiple cores that Chipaca is investigating.)

It just gets stuck there consuming CPU, check with top.

Tags: classic isv
Revision history for this message
Leo Arias (elopio) wrote :
Revision history for this message
Leo Arias (elopio) wrote :
Revision history for this message
Leo Arias (elopio) wrote :

This affects also the gopass snap:

$ sudo apt install git snapcraft
$ cd /tmp
$ git clone --recursive https://github.com/elopio/gopass
$ cd gopass
$ git checkout snapcraft
$ cd dist/snap
$ snapcraft
$ sudo snap install *.snap --dangerous --classic
$ gopass -h

Changed in snapd:
status: New → Confirmed
tags: added: isv
Revision history for this message
Ken VanDine (ken-vandine) wrote :

I can confirm this issue. I'm having the same problem with my gnome-calendar and gnome-contacts classic snaps.

Zygmunt Krynicki (zyga)
Changed in snapd:
assignee: nobody → Zygmunt Krynicki (zyga)
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is caused by snapcraft and the fact that this snap is using classic confinement.

The generated wrapper script has this content:

zyga@fyke:~/snapd$ cat /snap/gox/current/command-gox.wrapper
#!/bin/sh
exec "gox" "$@"

Since classic confinement does not reset PATH (because it cannot) gox is being resolved to /snap/bin/gox again, which causes exec/fork loop.

My suggestion would be to generate no wrappers for classic confinement or to warn people about this at build time.

Changed in snapd:
status: Confirmed → Invalid
Changed in snapcraft:
status: New → Confirmed
Changed in snapd:
assignee: Zygmunt Krynicki (zyga) → nobody
Revision history for this message
Leo Arias (elopio) wrote :

oh, nice finding. Thanks zyga.

mvo has a pr in progress to not generate the wrapper: https://github.com/snapcore/snapcraft/pull/1420

@sergiusens, should classic skip the wrapper by default?

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

This is known issue, generating no wrappers is a no go as we will loose functionality such as creating commands of the type

    command: env PATH=$SNAP/bin my-command

which is not allowed in snap.yaml

Revision history for this message
Leo Arias (elopio) wrote :

With bin/ in the command, gox works and I could propose it upstream:
https://github.com/mitchellh/gox/pull/89

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.