Bug 1119157

Summary: varnish systemd start stop script issues
Product: [Fedora] Fedora EPEL Reporter: Sklav <gnudna>
Component: varnishAssignee: Ingvar Hagelund <ingvar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: epel7CC: dahmage, gnudna, ingvar
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-31 08:01:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Sklav 2014-07-14 07:31:47 UTC
Description of problem:
systemctl start varnish.service hangs on start even though it is working in the background
and also the systemctl stop varnish.service does not stop the service

Version-Release number of selected component (if applicable):
varnish-4.0.0-3.el7.x86_64

How reproducible:
Simple to reproduce. Install varnish and then start the service using systemctl start varnish.service

Steps to Reproduce:
1. yum install varnish
2. systemctl start varnish.service (will hang and report it timed out and failed)
3. ps faxw (will show varnish is actually running
4. systemctl stop varnish (looks like it completes ok but service does not stop)
5. ps faxw (you should still see varnish running and accepting connections even though systemctl status varnish.service claims the service is stopped.

Actual results:
systemctl start varnish.service (will hang and report it timed out and failed)
ps faxw (will show varnish is actually running)
systemctl stop varnish (looks like it completes ok but service does not stop)
ps faxw (shows varnish still running)

Expected results:
when issuing systemctl start varnish.service it should not hang
when issuing systemctl stop varnish.service it should stop the running service

Additional info:

I believe this has been fixed on Fedora 20 based on some google searches but have not tested it yet.

Comment 1 Sklav 2014-07-18 05:59:18 UTC
Btw i was able to fix this by creating a systemd service script attached below. Obviously this probably needs some work since i just created it and have no experience with systemd in general.

vim /usr/lib/systemd/system/varnish.service

[Unit]
Description=High-performance HTTP accelerator

[Service]
Type=oneshot
ExecStart=/etc/init.d/varnish start
ExecStop=/etc/init.d/varnish stop
ExecStatus=/etc/init.d/varnish status
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Comment 2 Sklav 2014-07-18 06:03:29 UTC
Actually this should be somewhat more relevant

[Unit]
Description=High-performance HTTP accelerator

[Service]
Type=oneshot
ExecStart=/etc/init.d/varnish start
ExecStop=/etc/init.d/varnish stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Comment 3 David 2014-07-29 14:59:22 UTC
I also am having trouble getting varnish to work.  After installing varnish i issue 'systemctl start varnish' and get the following

Job for varnish.service failed. See 'systemctl status varnish.service' and 'journalctl -xn' for details.

systemctl status varnish shows the following:

varnish.service - LSB: start and stop varnishd
   Loaded: loaded (/etc/rc.d/init.d/varnish)
   Active: failed (Result: exit-code) since Tue 2014-07-29 10:54:59 EDT; 10s ago
  Process: 2105 ExecStart=/etc/rc.d/init.d/varnish start (code=exited, status=1/FAILURE)



I also tried creating the varnish.service file from comment 2, but it still failed to start and i couldn't find any more detailed information.

Comment 4 Ingvar Hagelund 2014-07-30 13:54:23 UTC
The systemd files for fedora should be used, and it's just a stupid packaging bug that they weren't included in the epel7 package in the first place. I'll roll an update with systemd support and an update to 4.0.1 today.

Ingvar

Comment 5 Ingvar Hagelund 2014-07-31 08:01:13 UTC
varnish-4.0.1-2.el7 was built yesterday, and should fix this issue. The package is available at http://koji.fedoraproject.org/koji/buildinfo?buildID=549140 , and should hit the mirrors within a few days.

Note that there is a selinux policy in centos7 prohibiting varnish from starting properly. It works well with selinux switched off. I haven't tested this on rhel7. I'll post a bug for this as well.

Ingvar

Comment 6 David 2014-08-11 19:41:25 UTC
varnish-4.0.1-2.el7 works for me when i disable selinux as you noted.  Can you give me the link to the selinux bug (if you created it already) so that i can follow that as well?

Comment 7 Ingvar Hagelund 2014-08-11 22:35:17 UTC
David, the selinux bug prohibiting varnishd from starting: #1125165

Ingvar