[systemd-devel] Stopping services started by Systemd socket

Liam Kelly liamkelly17 at gmail.com
Tue Jan 23 01:06:40 UTC 2018


How does Systemd communicate to socket activated application that the connection has been closed? How can I modify my application to detect this event if it cannot be configured to be closed automatically?

We are trying to add network support to legacy code using Systemd sockets. Using the 0pointer tutorials, we were able to configure a listening TCP port and launch an instance of the application when a TCP connection came in. The problem is that when the connection is closed, the service is still running.

The systemct list-units and netstat -tuapn outputs are what you would expect when the connection is established

    systemctl list-units:
    myapp at 5-192.168.0.75:10001-192.168.210.102:19983.service loaded active running   My App
    netstat -tuapn:
    tcp        0      0 192.168.0.75:10001      192.168.210.102:19983   ESTABLISHED 1/init
However, once the client closes the connection, the socket is closed and removed, but the application is still running as a service:

    systemctl list-units:
    myapp at 5-192.168.0.75:10001-192.168.210.102:19983.service loaded active running   My App
    netstat -tuapn:
    [no entry]

-Liam Kelly

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180122/bc113b8c/attachment.html>


More information about the systemd-devel mailing list