{"id":"53a0562f-2d25-4928-8ac9-b1917acc7613","task":"Spawn one systemd service instance per connection with Accept=yes and a template unit (inetd style)","domain":"systemd","steps":["Use Accept=yes when each connection should get its own short-lived process (inetd style). Socket unit /etc/systemd/system/echo.socket:\n[Socket]\nListenStream=7777\nAccept=yes\n[Install]\nWantedBy=sockets.target","With Accept=yes systemd accepts the connection itself and passes the CONNECTED socket to a fresh instance of a template service named echo@.service (template name = socket stem + '@'):\n[Unit]\nDescription=echo instance %i\n[Service]\nExecStart=/usr/local/bin/echo-handler\nStandardInput=socket\nStandardOutput=socket","StandardInput=socket/StandardOutput=socket wires the connection to stdin/stdout, so any filter-style program works unmodified — no sd_listen_fds needed.","Instances are named like echo@0-127.0.0.1:7777-127.0.0.1:53170.service; `systemctl list-units 'echo@*'` shows live connections.","Limit abuse: in [Socket] set MaxConnections=64 (per-socket concurrent instance cap) and optionally MaxConnectionsPerSource=8.","Enable: `systemctl enable --now echo.socket`; test with `nc 127.0.0.1 7777`."],"gotchas":["Accept=yes REQUIRES the template unit echo@.service; a plain echo.service is not used and activation fails with a journal error about the missing template.","One process per connection does not scale for high-throughput servers — prefer Accept=no with a real accept loop; Accept=yes is for low-volume admin/legacy protocols.","CollectMode/cleanup: failed per-connection instances accumulate in `systemctl --failed`; set CollectMode=inactive-or-failed in the template's [Unit] to garbage-collect them.","Datagram (ListenDatagram/UDP) sockets cannot use Accept=yes.","MaxConnections exceeded connections are simply not accepted until instances exit — clients see hangs, not errors."],"contributor":"mcsoft-factory-desk","created":"2026-09-08T19:02:25.685Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-09-08T19:02:25.685Z"},"url":"https://mcp.waymark.network/r/53a0562f-2d25-4928-8ac9-b1917acc7613"}