Bug 842003

Summary: ypbind/systemd: systemctl stop ypbind.service always has to time out
Product: [openSUSE] openSUSE Tumbleweed Reporter: Stefan Seyfried <seife>
Component: BasesystemAssignee: E-mail List <bnc-team-screening>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: fcrozat
Version: 13.1 Beta 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Third Party Developer/Partner Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Stefan Seyfried 2013-09-24 09:05:54 UTC
"systemctl stop ypbind.service" does not recognize that ypbind has already stopped:

susi:~ # systemctl status ypbind.service
ypbind.service - NIS/YP (Network Information Service) Clients to NIS Domain Binder
   Loaded: loaded (/usr/lib/systemd/system/ypbind.service; disabled)
   Active: active (running) since Tue 2013-09-24 10:53:28 CEST; 11s ago
  Process: 23285 ExecStopPost=/bin/sh -c /bin/rm -f /var/yp/binding/* /var/run/ypbind.pid (code=exited, status=0/SUCCESS)
  Process: 18651 ExecStartPost=/usr/lib/ypbind/ypbind-systemd-post (code=exited, status=0/SUCCESS)
  Process: 18644 ExecStartPre=/usr/lib/ypbind/ypbind-systemd-pre (code=exited, status=0/SUCCESS)
 Main PID: 18647 (ypbind)
   Status: "Processing requests..."
   CGroup: /system.slice/ypbind.service
           └─18647 /usr/sbin/ypbind -n

Sep 24 10:53:28 susi.home.s3e.de systemd[1]: Started NIS/YP (Network Information Service) Clients to NIS ...der.
Hint: Some lines were ellipsized, use -l to show in full.

susi:~ # systemctl stop ypbind.service
[wait....a...long...time]
[switch to other console]
susi:~ # systemctl status ypbind.service
ypbind.service - NIS/YP (Network Information Service) Clients to NIS Domain Binder
   Loaded: loaded (/usr/lib/systemd/system/ypbind.service; disabled)
   Active: deactivating (stop-sigkill) (Result: timeout) since Tue 2013-09-24 10:54:25 CEST; 2min 46s ago
  Process: 23285 ExecStopPost=/bin/sh -c /bin/rm -f /var/yp/binding/* /var/run/ypbind.pid (code=exited, status=0/SUCCESS)
  Process: 18651 ExecStartPost=/usr/lib/ypbind/ypbind-systemd-post (code=exited, status=0/SUCCESS)
  Process: 18644 ExecStartPre=/usr/lib/ypbind/ypbind-systemd-pre (code=exited, status=0/SUCCESS)
 Main PID: 18647
   Status: "Processing requests..."
   CGroup: /system.slice/ypbind.service

Sep 24 10:53:28 susi.home.s3e.de systemd[1]: Started NIS/YP (Network Information Service) Clients to NIS ...der.
Sep 24 10:54:25 susi.home.s3e.de systemd[1]: Stopping NIS/YP (Network Information Service) Clients to NIS...r...
Sep 24 10:55:55 susi.home.s3e.de systemd[1]: ypbind.service stopping timed out. Killing.
Hint: Some lines were ellipsized, use -l to show in full.
susi:~ # systemctl list-jobs
 JOB UNIT           TYPE STATE  
5188 ypbind.service stop running

1 jobs listed.
susi:~ # 
[back to original console]
[...wait...]
...finally finishes...
susi:~ # systemctl status ypbind.service
ypbind.service - NIS/YP (Network Information Service) Clients to NIS Domain Binder
   Loaded: loaded (/usr/lib/systemd/system/ypbind.service; disabled)
   Active: failed (Result: timeout) since Tue 2013-09-24 10:57:25 CEST; 6min ago
  Process: 18814 ExecStopPost=/bin/sh -c /bin/rm -f /var/yp/binding/* /var/run/ypbind.pid (code=exited, status=0/SUCCESS)
  Process: 18651 ExecStartPost=/usr/lib/ypbind/ypbind-systemd-post (code=exited, status=0/SUCCESS)
  Process: 18644 ExecStartPre=/usr/lib/ypbind/ypbind-systemd-pre (code=exited, status=0/SUCCESS)
 Main PID: 18647
   Status: "Processing requests..."
   CGroup: /system.slice/ypbind.service

Sep 24 10:53:28 susi.home.s3e.de systemd[1]: Started NIS/YP (Network Information Service) Clients to NIS ...der.
Sep 24 10:54:25 susi.home.s3e.de systemd[1]: Stopping NIS/YP (Network Information Service) Clients to NIS...r...
Sep 24 10:55:55 susi.home.s3e.de systemd[1]: ypbind.service stopping timed out. Killing.
Sep 24 10:57:25 susi.home.s3e.de systemd[1]: ypbind.service still around after SIGKILL. Ignoring.
Sep 24 10:57:25 susi.home.s3e.de systemd[1]: Stopped NIS/YP (Network Information Service) Clients to NIS ...der.
Sep 24 10:57:25 susi.home.s3e.de systemd[1]: Unit ypbind.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

------------------------------------

there is nothing around after SIGKILL, not even before, ypbind has already exited before.
This also happens on system shutdown, adding a 3 minute timeout until the machine finally shuts down.
Comment 1 Stefan Seyfried 2013-09-24 09:35:47 UTC
I first guessed this might be a bug in how ypbind handles sd_notify, but reading the documentation, I can not see any fault there.
Additionally, changing the service file to "Type=simple" did not change anything.

My guess is that systemd has a bug with ExecStopPost= handling, as this is not used very often and thus probably not well tested. ExecStopPost is clearly run (pid file is removed etc), but maybe something waits on it to finish or similar.
Comment 2 Frederic Crozat 2013-09-24 11:37:02 UTC
Probably a duplicate of bnc#841544

*** This bug has been marked as a duplicate of bug 841544 ***