Hello again,
I've worked around ruby's daemonize implementation by rewriting the app to be of type simple. However, now I'm seeing the long delay on stop after the application it executes has run once. The application is a real time app utilizing RTAI. The real time application is started by a scripted web daemon (the one I recently modified because of problems between it and systemd.) It forks and then calls exec to start the real time application, but until told to do so.

The scripted web daemon is started by systemd. Systemd keeps track of every forked child process, right? Here is a status report showing what its status is shortly after normal startup:

--------------------------------------------------------------------------------------
[rtuser@localhost ~]$ sudo systemctl status webapp.service
webapp.service - scripted daemon
         Loaded: loaded (/etc/systemd/system/webapp.service)
Active: active (running) since Tue, 22 Jan 2013 01:42:30 -0700; 7min ago Process: 553 ExecStartPre=/home/rtuser/rtapp/scripts/preStart.sh (code=exited, status=0/SUCCESS)
       Main PID: 906 (ruby)
         CGroup: name=systemd:/system/webapp.service
                 â 906 /usr/bin/ruby /home/rtuser/rtapp/bin/webapp.rb
--------------------------------------------------------------------------------------

At this point, everything is fine. It will stop almost instantaneously. And here it is after the real time app has been started and then subsequently successfully stopped after all calls to free up and shutdown real time resources have completed and all processes (except the webapp) have exited.

--------------------------------------------------------------------------------------
[rtuser@localhost ~]$ sudo systemctl status webapp.service
webapp.service - scripted daemon
         Loaded: loaded (/etc/systemd/system/webapp.service)
Active: active (running) since Tue, 22 Jan 2013 01:42:30 -0700; 17min ago Process: 553 ExecStartPre=/home/rtuser/rtapp/scripts/preStart.sh (code=exited, status=0/SUCCESS)
       Main PID: 906 (ruby)
         CGroup: name=systemd:/system/webapp.service
                 â  906 /usr/bin/ruby /home/rtuser/rtapp/bin/webapp.rb
                 â 1040 [RTAI_KTHRD_M:0]
                 â 1041 [F:HARD:0:1]
                 â 1042 [RTAI_KTHRD_M:1]
                 â 1043 [F:HARD:1:1]
                 â 1044 [F:HARD:0:2]
                 â 1045 [F:HARD:1:2]
                 â 1046 [F:HARD:0:3]
                 â 1047 [F:HARD:1:3]
                 â 1048 [F:HARD:0:4]
                 â 1049 [F:HARD:1:4]
                 â 1050 [F:HARD:0:5]
                 â 1051 [F:HARD:1:5]
                 â 1052 [F:HARD:0:6]
                 â 1053 [F:HARD:1:6]
--------------------------------------------------------------------------------------

Subsequent starts and stops of the application of course do not change those process ID and kernel threads because, I can only assume, they are reused. A kill -9 as root will not even kill them. The problem I have is that system shutdown times take quite a few minutes unless systemd has done everything it can to kill these, correct? This mostly results in a very long delay on a timeout waiting for dependent processes to die when they never will on shutdown or restart of the computer or just the webapp service.

I've already posted to the rtai mailing list about this. I've tried using RemainAfterExit=yes (and no) in the webapp.service file as previously suggested with no avail. The service file currently looks like:

[Unit]
Description=scripted daemon
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/rtuser/rtapp/bin
PIDFile=/home/rtuser/rtapp/data/logs/webapp.pid
ExecStartPre=/home/rtuser/rtapp/scripts/preStart.sh
ExecStart=/home/rtuser/rtapp/bin/webapp.rb
StandardInput=null
StandardOutput=syslog
StandardError=syslog
User=sim
Group=sim
ControlGroup=cpu:/

[Install]
WantedBy=multi-user.target


I think those threads not getting shutdown then RTAI may be designed as such and if so, saying RTAI needs to change it's design wouldn't be very helpful. I'm trying to get this figured out so system shutdowns and service restarts will not take forever compared to startup. Any help would be immensely appreciated!

Thanks,
JB
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to