Snapcraft Socket missing Backlog?

Snapcraft Service’s have several config options similar to systemd. For instance, listen-stream and mode etc. https://snapcraft.io/docs/services-and-daemons

However, there is no Backlog in Snapcraft as there is in systemd?

[Socket]

ListenStream=xyz

Backlog=10

SocketMode=0660

How would one set the Backlog in a Snap Socket?

You wouldn’t. It needs to be added to snapd first to work ootb. Nobody has asked for that yet, so happy to review a pull request if you with to give it a try.

Alternatively, you can maybe have a local drop-in config. The socket unit name is predictable, so you could write a file like this:

# /etc/systemd/system/snap.foo.bar.baz.socket.d/99-override.conf
[Socket]
Backlog=<your-value>

where foo.bar.baz corresponds to a snap foo, having a daemon bar, which lists activation socket of name baz.

BTW. is the default not good enough? I think it’s usually set to 4096+.

Well, the default is actually too big. I am migrating some services into a Snap and they set their Backlog to 10. I didn’t want to mess with that.

I appreciate the workaround – but I’m pretty sure that wont work on Ubuntu Core?

I’ll work the same. You’ll have to access the device to put the file there.

Yes. However, it appears when you are within the snap you can write to /etc/systemd/system so perhaps this is also a workaround.

I found myself having no choice but to do this since, also, snapcraft is missing Type=exec. Snapcraft only supports Type=simple. There is a minor difference here but THERE IS a difference.

All services in my snapcraft are set not to launch are snap install time. This gives me time to run:

find /etc/systemd/system -type f -name “snap.thio*.service” -exec sed -i ‘s/Type=simple/Type=exec/g’ {} +

thio == my snap name