Bug 737264 - Provide native systemd service files
Summary: Provide native systemd service files
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: cvs
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL: http://lists.freedesktop.org/archives...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-10 12:05 UTC by Jóhann B. Guðmundsson
Modified: 2013-02-21 05:45 UTC (History)
2 users (show)

Fixed In Version: cvs-1.11.23-22.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-16 13:43:37 UTC


Attachments (Terms of Use)
cvs socket (133 bytes, text/plain)
2011-09-10 12:05 UTC, Jóhann B. Guðmundsson
no flags Details
cvs service (166 bytes, text/plain)
2011-09-10 12:06 UTC, Jóhann B. Guðmundsson
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 802748 None None None Never

Internal Links: 802748

Description Jóhann B. Guðmundsson 2011-09-10 12:05:03 UTC
Description of problem:

Let's get the ball rolling on this one...

http://fedoraproject.org/wiki/Features/SysVtoSystemd

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Jóhann B. Guðmundsson 2011-09-10 12:05:39 UTC
Created attachment 522518 [details]
cvs socket

Comment 2 Jóhann B. Guðmundsson 2011-09-10 12:06:25 UTC
Created attachment 522519 [details]
cvs service

Comment 3 Jóhann B. Guðmundsson 2011-09-10 12:07:50 UTC
Once package and shipped your package should no longer have to depend on xinetd

https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

Comment 4 Petr Pisar 2011-09-12 09:22:16 UTC
The socket file has 

[Install]
WantedBy=sockets.target

Does it mean the socket becomes listing automatically and hence the service available by default? I don't think this is good idea. Moreover <https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd#Socket_activation> writes automatic activation requires FESCo exception.

Comment 5 Jóhann B. Guðmundsson 2011-09-12 09:52:33 UTC
That happens only if you enable it at install time and afaik service are supposed to be not enabled by default without granted permission from fesco so installing it but not enable it should suffice.

Users would have to run systemctl start $foo.socket and systemctl enable $foo.socket for the service to start/enable the service/socket

Comment 6 Petr Pisar 2011-09-15 15:30:52 UTC
You are right.

I found another issue. If socket-activated cvs process exits with failure, systemd keeps service records (systemctl --all --full adds new line). Is it intentional from point of view of systemd? I just ask because PID=1 process then allocates about 9.9 KB for each terminated service, so this looks like attack vector. Is there any way how to shrink the list of failed services?

Comment 7 Petr Pisar 2011-09-19 12:56:34 UTC
(In reply to comment #6)
> I found another issue. If socket-activated cvs process exits with failure,
> systemd keeps service records (systemctl --all --full adds new line). Is it
> intentional from point of view of systemd? I just ask because PID=1 process
> then allocates about 9.9 KB for each terminated service, so this looks like
> attack vector. Is there any way how to shrink the list of failed services?

See bug #739538.

Comment 8 Jiri Popelka 2012-12-19 17:41:55 UTC
Petr,

I've just done (bug #884641) a very similar (xinetd -> socket activatable systemd service) migration with cups-lpd. I've been out of curiosity looking for similar services and found this and I *think* the scriptlets you've used in cvs.spec are not good.

cvs.spec has had for example:

%preun
%systemd_preun cvs@.service

where [1] %systemd_preun macro is:
if [ $1 -eq 0 ] ; then \
        # Package removal, not upgrade \
        @rootbindir@/systemctl --no-reload disable %{?*} > /dev/null 2>&1 || : \
        @rootbindir@/systemctl stop %{?*} > /dev/null 2>&1 || : \
fi \

The 'systemctl --no-reload disable cvs@.service' or 'systemctl stop cvs@.service' result in 'Failed to issue method call:'.

So I think there should be
%systemd_post cvs.socket
%systemd_preun cvs.socket
%systemd_postun_with_restart cvs.socket
instead of
%systemd_post cvs@.service
%systemd_preun cvs@.service
%systemd_postun_with_restart cvs@.service
because you need to enable/disable/start/stop the cvs.socket and not the cvs@.service

What do you think ?

[1] http://cgit.freedesktop.org/systemd/systemd/tree/src/core/macros.systemd.in

Comment 9 Petr Pisar 2012-12-19 18:41:40 UTC
I bet when I were developing the code it was working. Now I get the same results as you. Moreover stopping cvs.socket closes listening TCP socket, but keeps connected servers running.

Comment 10 Petr Pisar 2012-12-19 18:49:05 UTC
CVS process terminates only when stopping exact instance of cvs@.service (e.g. cvs@1-::1:2401-::1:35341.service) however the TCP connection remains connected to PID 1.

Comment 11 Petr Pisar 2012-12-20 13:07:43 UTC
I asked systemd developers how to stop all instances <http://lists.freedesktop.org/archives/systemd-devel/2012-December/007817.html>.

Comment 12 Petr Pisar 2013-02-12 12:40:44 UTC
I fixed stopping socket in cvs-1.11.23-29.fc19. I also added cvs.target which can be used to stop the socket and all server instances.

Comment 13 Fedora Update System 2013-02-12 12:52:54 UTC
cvs-1.11.23-29.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/cvs-1.11.23-29.fc18

Comment 14 Fedora Update System 2013-02-12 13:07:53 UTC
cvs-1.11.23-26.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/cvs-1.11.23-26.fc17

Comment 15 Fedora Update System 2013-02-21 05:36:16 UTC
cvs-1.11.23-26.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2013-02-21 05:45:50 UTC
cvs-1.11.23-29.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.