RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1257129 - systemctl stop rpcbind return 0 but actually doesn't stop the rpcbind.service
Summary: systemctl stop rpcbind return 0 but actually doesn't stop the rpcbind.service
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-26 10:29 UTC by Yongcheng Yang
Modified: 2015-09-07 07:12 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-09-02 10:20:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Yongcheng Yang 2015-08-26 10:29:33 UTC
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 16:56:28 UTC
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-31 01:06:52 UTC
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 10:50:33 UTC
With socket activated services you should stop the socket first.

Comment 10 Yongcheng Yang 2015-09-02 00:06:21 UTC
(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 10:20:53 UTC
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 09:00:11 UTC
(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 07:12:49 UTC
(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.