[systemd-bugs] [Bug 86748] New: systemctl restart does not return for target

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Nov 26 09:47:33 PST 2014


https://bugs.freedesktop.org/show_bug.cgi?id=86748

            Bug ID: 86748
           Summary: systemctl restart does not return for target
           Product: systemd
           Version: unspecified
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
          Assignee: systemd-bugs at lists.freedesktop.org
          Reporter: juravel2 at gmail.com
        QA Contact: systemd-bugs at lists.freedesktop.org

Hi,

Described behaviour is reproduced for systemd-208(RHEL), systemd-215 and
trunk(calculate linux).
However, I'm not sure if it is actually a bug, or just misconfiguration of
services.
STR:
1) Create following unit files:
$ cat env at .target 
[Unit]
Description=Test Environment Target

[Install]
WantedBy=multi-user.target
$ cat serv at .service 
[Unit]
Description=Service which is part of environment
Requires=env@%i.target

[Service]
PIDFile=/root/test.pid
Type=forking
ExecStart=/usr/bin/python /root/test_service.py
Restart=on-failure
RestartSec=30
TimeoutStopSec=30
KillMode=process

[Install]
WantedBy=multi-user.target
WantedBy=env@%i.target

test_service.py is simple script, which emulates either a fine working daemon,
or a daemon which fails to start:
$ cat /root/test_service.py 
#!/usr/bin/env python
import os
from time import sleep
if os.fork() != 0:
    os._exit(0)
os.setsid()
if os.fork() != 0:
    os._exit(0)
os.chdir('/')
## os._exit(2) ## uncomment to emulate failing daemon
pid_fo = open('/root/test.pid', 'w')
pid_fo.write(str(os.getpid()) + '\n')
pid_fo.close()
sleep(3600)

2) Enable target and service and start them:
systemctl enable serv at 1.2.3.4
systemctl enable env at 1.2.3.4.target
systemctl start env at 1.2.3.4.target serv at 1.2.3.4

3) Uncomment "os._exit(2)" and restart env at 1.2.3.4.target:
time systemctl restart env at 1.2.3.4.target

Expected result:
restart command should fail, as "systemctl restart serv at 1.2.3.4" fails:
# systemctl restart serv at 1.2.3.4
Job for serv at 1.2.3.4.service failed. See "systemctl status
serv at 1.2.3.4.service" and "journalctl -xe" for details.

Actual result:
systemctl does not return:
# time systemctl restart env at 1.2.3.4.target 
^C
real    16m0.964s
user    0m0.010s
sys    0m0.000s

Backtrace for systemd-208 systemctl:
#0  0x00007f3766cdeec0 in __poll_nocancel () at
../sysdeps/unix/syscall-template.S:81
#1  0x00007f3767ab7780 in socket_do_iteration () from /lib64/libdbus-1.so.3
#2  0x00007f3767ab65ff in _dbus_transport_do_iteration () from
/lib64/libdbus-1.so.3
#3  0x00007f3767a9fd7c in _dbus_connection_do_iteration_unlocked () from
/lib64/libdbus-1.so.3
#4  0x00007f3767aa2112 in _dbus_connection_read_write_dispatch () from
/lib64/libdbus-1.so.3
#5  0x00007f3768112029 in start_unit ()
#6  0x00007f3768108ac5 in main ()

If serv at .service unit file is created without "Requires=env@%i.target",
everything works just fine.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20141126/bdccd59f/attachment.html>


More information about the systemd-bugs mailing list