Bug 1257129 - systemctl stop rpcbind return 0 but actually doesn't stop the rpcbind.service
systemctl stop rpcbind return 0 but actually doesn't stop the rpcbind.service
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: systemd-maint
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-26 06:29 EDT by Yongcheng Yang
Modified: 2015-09-07 03:12 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-09-02 06:20:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Yongcheng Yang 2015-08-26 06:29:33 EDT
Description of problem:
After "systemctl restart rpcbind", stop it using "systemctl stop rpcbind".
It returns 0 showing successful. But actually the rpcbind.service is still running.

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

How reproducible:
100%

Steps to Reproduce:
1. service rpcbind restart
2. service rpcbind stop
3. service rpcbind status

Actual results:
[root@hp-dl160g8-01 ~]# cat rpcbind_cannot_stop.sh
for i in `seq 10`; do
	systemctl restart rpcbind.service 2>/dev/null
                  ^^^^^^^ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< using "restart"
	[ $? != 0 ] && exit 1
	systemctl stop rpcbind.service 2>/dev/null
	[ $? != 0 ] && exit 1
	sleep 1
	systemctl status rpcbind.service
	systemctl reset-failed
done
[root@hp-dl160g8-01 ~]# ./rpcbind_cannot_stop.sh
● rpcbind.service - RPC bind service
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled)
   Active: active (running) since Wed 2015-08-26 18:13:26 CST; 1s ago
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Process: 54658 ExecStart=/sbin/rpcbind -w ${RPCBIND_ARGS} (code=exited, status=0/SUCCESS)
 Main PID: 54660 (rpcbind)
   CGroup: /system.slice/rpcbind.service
           └─54660 /sbin/rpcbind -w

Aug 26 18:13:26 hp-dl160g8-01.rhts.eng.pek2.redhat.com systemd[1]: Starting RPC bind service...
Aug 26 18:13:26 hp-dl160g8-01.rhts.eng.pek2.redhat.com systemd[1]: Started RPC bind service.
...


Expected results:
[root@hp-dl160g8-01 ~]# service rpcbind restart
[root@hp-dl160g8-01 ~]# service rpcbind stop
[root@hp-dl160g8-01 ~]# service rpcbind status
● rpcbind.service - RPC bind service
...
   Active: inactive (dead)
...

Additional info:
a. This issue cannot be reproduced in RHEL-7.0, so set the keyword "Regression"
b. It works OK if we use "systemctl start rpcbind" but not "... restart ..."
c. We can also stop the rpcbind.service if exec "systemctl stop rpcbind" twice
Comment 3 Steve Dickson 2015-08-26 12:56:28 EDT
rpcbind is socket activated which means rpcbind will start when
an app send a message to port 111... This is done by systemd...

so the scripts will act differently then most...
Comment 7 Yongcheng Yang 2015-08-30 21:06:52 EDT
Change to Component "systemd" to investigate it some more.

In summary:

a. "systemctl restart rpcbind; systemctl stop rpcbind; systemctl status rpcbind" shows the rpcbind.service is still running;

b. "systemctl start rpcbind; systemctl stop rpcbind" can work;
             ^^^^^^^ change "restart" to "start"

c. "systemctl restart rpcbind; systemctl stop rpcbind; systemctl stop rpcbind" 
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^stop twice
can work.
Comment 8 Lukáš Nykrýn 2015-09-01 06:50:33 EDT
With socket activated services you should stop the socket first.
Comment 10 Yongcheng Yang 2015-09-01 20:06:21 EDT
(In reply to Lukáš Nykrýn from comment #8)
> With socket activated services you should stop the socket first.

Then why while the socket still be active, and can stop the rpcbind (by stop it twice, refer Comment 5)
Comment 11 Lukáš Nykrýn 2015-09-02 06:20:53 EDT
It depends on incoming connections. Generally stopping the service without stopping the socket does not make sense. Maybe in such cases we should put PartOf=xxxxx.service to xxxxx.socket. Then stop to service will also shut down the socket. But there is no policy for this.

But again you case will perform randomly and that is expected result form our side.
Comment 12 Yongcheng Yang 2015-09-06 05:00:11 EDT
(In reply to Lukáš Nykrýn from comment #11)
> It depends on incoming connections. Generally stopping the service without
> stopping the socket does not make sense. Maybe in such cases we should put
> PartOf=xxxxx.service to xxxxx.socket. Then stop to service will also shut
> down the socket. But there is no policy for this.
> 
> But again you case will perform randomly and that is expected result from
> our side.

Yes, I can understand that "stopping the rpcbind.service without stopping the socket does not make sense".

But there are some Inconsistent actions as Description said:
a. This issue cannot be reproduced in RHEL-7.0
b. We can stop it if start it using "systemctl start rpcbind" but not "restart"
c. We can also stop the rpcbind.service if exec "systemctl stop rpcbind" twice

And the above issues are all 100% reproduced.

BTW. Could you please help to find what the difference between "start xxx.service" and "restart xxx.service" is, or where can we find some doc related. Thanks in advance.
Comment 13 Michal Sekletar 2015-09-07 03:12:49 EDT
(In reply to Yongcheng Yang from comment #12)
> 
> But there are some Inconsistent actions as Description said:
> a. This issue cannot be reproduced in RHEL-7.0

rpcbind as shipped in RHEL-7.0 did not support socket activation. See comment #6.

> b. We can stop it if start it using "systemctl start rpcbind" but not
> "restart"

I tried it multiple times with recent compose of RHEL-7.2 and I am getting unpredictable behavior (sometimes rpcbind is inactive, otherwise running), as expected with socket activation.

> c. We can also stop the rpcbind.service if exec "systemctl stop rpcbind"
> twice

This observation was basically pure luck.

> 
> And the above issues are all 100% reproduced.

I don't think so.

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