<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - systemctl restart does not return for target"
href="https://bugs.freedesktop.org/show_bug.cgi?id=86748">86748</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>systemctl restart does not return for target
</td>
</tr>
<tr>
<th>Product</th>
<td>systemd
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Assignee</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>juravel2@gmail.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>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@.target
[Unit]
Description=Test Environment Target
[Install]
WantedBy=multi-user.target
$ cat serv@.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 <a href="mailto:serv@1.2.3.4">serv@1.2.3.4</a>
systemctl enable <a href="mailto:env@1.2.3.4.target">env@1.2.3.4.target</a>
systemctl start <a href="mailto:env@1.2.3.4.target">env@1.2.3.4.target</a> <a href="mailto:serv@1.2.3.4">serv@1.2.3.4</a>
3) Uncomment "os._exit(2)" and restart <a href="mailto:env@1.2.3.4.target">env@1.2.3.4.target</a>:
time systemctl restart <a href="mailto:env@1.2.3.4.target">env@1.2.3.4.target</a>
Expected result:
restart command should fail, as "systemctl restart <a href="mailto:serv@1.2.3.4">serv@1.2.3.4</a>" fails:
# systemctl restart <a href="mailto:serv@1.2.3.4">serv@1.2.3.4</a>
Job for <a href="mailto:serv@1.2.3.4.service">serv@1.2.3.4.service</a> failed. See "systemctl status
<a href="mailto:serv@1.2.3.4.service">serv@1.2.3.4.service</a>" and "journalctl -xe" for details.
Actual result:
systemctl does not return:
# time systemctl restart <a href="mailto:env@1.2.3.4.target">env@1.2.3.4.target</a>
^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@.service unit file is created without "Requires=env@%i.target",
everything works just fine.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>