/etc/init.d/FAHClient not creating PID file on start

Moderators: Site Moderators, FAHC Science Team

Post Reply
Andrew
Posts: 8
Joined: Thu Nov 19, 2020 3:42 am

/etc/init.d/FAHClient not creating PID file on start

Post by Andrew »

Hi folks,

I recently updated to the latest v7.6.21 of Folding@Home, running on CentOS 8.x. Post-upgrade, running './FAHClient status' and './FAHClient stop' do not function. After some investigation, it appears the PID file defined in the logic is not being created on startup of FAH (--pid-file=/var/run/fahclient.pid), which I believe to be causing the 'status' and 'stop' flags to ultimately fail, since it is not seeing the PID. Running the command './FAHClient start' does in fact work; however, if I need to cycle or stop the process for any reason, it must be killed at the OS level.

A few things I have tried:

1. Providing ample privs on /var/run/
2. Removed the rpm and reinstalled F@H
3. Rebooted the system

I was hoping someone has run into this issue before, or would be able to provide any input on the issue.

Thanks!
Whompithian
Posts: 39
Joined: Thu Jun 25, 2020 12:40 am

Re: /etc/init.d/FAHClient not creating PID file on start

Post by Whompithian »

viewtopic.php?f=108&t=36200#p344141

That post contains my advice for installing and running FAHClient on RPM-based distros. Essentially, explicitly creating a systemd unit to override the behavior of the init.d script solves numerous client issues.
Andrew
Posts: 8
Joined: Thu Nov 19, 2020 3:42 am

Re: /etc/init.d/FAHClient not creating PID file on start

Post by Andrew »

Appreciate the feedback, Whompithian! At first glance, I think this may ultimately resolve my issue, if I move to systemd for the service based off your link.

My understanding is that /usr/bin/FAHClient is not open source, so I have had some challenges debugging it. Before your post, I made some minor logic changes to /etc/init.d/FAHClient in order to work around the fact that the PID file is not being created when /usr/bin/FAHClient is run. It seems like the /etc/init.d/FAHClient logic does not necessarily align with the code in /usr/bin/FAHClient if it is not properly able to manage the executable. Perhaps updates were made to /usr/bin/FAHClient without taking into consideration the implications on the /etc/init.d/FAHClient logic; however, it is challenging to track down root cause without knowing the code behind /usr/bin/FAHClient.

Thanks again!
Hopfgeist
Posts: 71
Joined: Thu Jul 09, 2020 12:07 pm
Hardware configuration: Dell T420, 2x Xeon E5-2470 v2, NetBSD 10, SunFire X2270 M2, 2x Xeon X5675, NetBSD 9; various other Linux/NetBSD PCs, Macs and virtual servers.
Location: Germany

Re: /etc/init.d/FAHClient not creating PID file on start

Post by Hopfgeist »

I also noticed that the pid file feature stopped working after 7.6.13, but I could use process name matching instead which is currently good enough. It seems to be a regression error, though, since I can't think of any reason why removing that (documented) feature would be intentional.

Just my thoughts,
HG.
Image
Dell PowerEdge T420: 2x Xeon E5-2470 v2
Andrew
Posts: 8
Joined: Thu Nov 19, 2020 3:42 am

Re: /etc/init.d/FAHClient not creating PID file on start

Post by Andrew »

Hopfgeist, could you expand on the 'name matching' work flow for my understanding? I'm curious what you mean by this.

Thanks!
Andrew
Posts: 8
Joined: Thu Nov 19, 2020 3:42 am

Re: /etc/init.d/FAHClient not creating PID file on start

Post by Andrew »

Hopfgeist - That's funny, I was looking in my F@H install directory, and had the v7.6.13 rpm sitting there, so it would seen as if something has changed since that version.
Hopfgeist
Posts: 71
Joined: Thu Jul 09, 2020 12:07 pm
Hardware configuration: Dell T420, 2x Xeon E5-2470 v2, NetBSD 10, SunFire X2270 M2, 2x Xeon X5675, NetBSD 9; various other Linux/NetBSD PCs, Macs and virtual servers.
Location: Germany

Re: /etc/init.d/FAHClient not creating PID file on start

Post by Hopfgeist »

Andrew wrote:Hopfgeist, could you expand on the 'name matching' work flow for my understanding? I'm curious what you mean by this.

Thanks!
I use monit to monitor my FAH Client, restart it if crashes or at system boot, etc. I used to use the pid file for that, which is preferable, because it is guaranteed unique, but now I just have monit look at the process names to find the correct task. That may fail if another task is also called "FAHClient", but that is so rare that I don't worry about it.

The monit website looks very flashy, but the monitoring tool itself is free and open source and there are packages for most unix/Linux systems.

Process name matching is also the only way to watch for an actual calculation core (FahCore_a7, or FahCore_a8), because that has never created a pid file.

Many unix-like operating systems have "pgrep" and "pkill" command-line tools to find (and signal or kill) a process by its name, instead of the process id, which can be used in shell-scripts.

I hope that clears it up, but just ask if you any more questions.

My workflow is very specific to my system, but I can share my monit setup (for NetBSD) if you like.

Cheers,
HG.
Image
Dell PowerEdge T420: 2x Xeon E5-2470 v2
berny156
Posts: 3
Joined: Fri Nov 20, 2020 2:44 pm

Re: /etc/init.d/FAHClient not creating PID file on start

Post by berny156 »

I confirm that FAHClient 7.6.21 for Linux stopped creating a PID file. Before, it was created by the binary rather than the init script. I can't detect any change in behaviour when using any of the options 'pid' or 'pidfile'.

It looks like a regression to me.
davidhcefx
Posts: 2
Joined: Tue Apr 20, 2021 5:41 pm

Re: /etc/init.d/FAHClient not creating PID file on start

Post by davidhcefx »

I think adding a line to the /etc/init.d/FAHClient script might work. But I still hope they could fix it. (Plus make it open source :) )

Code: Select all

@@ -121,6 +121,7 @@ start() {
     fi
 
     pid=$!
+    echo $pid > $PID
     if wait_for_log_change "$LOG_STATUS" $pid; then
         echo "OK"
     else
Image
toTOW
Site Moderator
Posts: 6296
Joined: Sun Dec 02, 2007 10:38 am
Location: Bordeaux, France
Contact:

Re: /etc/init.d/FAHClient not creating PID file on start

Post by toTOW »

Also be careful : on Ubuntu distribution, older FAHClient used to run under a dedicated account, but the latest one (7.6.21) is now running as root ... it broke all the stop features (init.d, service, systemctl) ...
Image

Folding@Home beta tester since 2002. Folding Forum moderator since July 2008.
gunnarre
Posts: 567
Joined: Sun May 24, 2020 7:23 pm
Location: Norway

Re: /etc/init.d/FAHClient not creating PID file on start

Post by gunnarre »

I'm running FAHclient version 7.6.21 on Ubuntu with the custom systemd startup script, and using that it still runs as the user "fahclient". GPU folding also works by using that startup-script rather than the included init.d script.
Image
Online: GTX 1660 Super, GTX 1080, GTX 1050 Ti 4G OC, RX580 + occasional CPU folding in the cold.
Offline: Radeon HD 7770, GTX 960, GTX 950
gordonbb
Posts: 510
Joined: Mon May 21, 2018 4:12 pm
Hardware configuration: Ubuntu 22.04.2 LTS; NVidia 525.60.11; 2 x 4070ti; 4070; 4060ti; 3x 3080; 3070ti; 3070
Location: Great White North

Re: /etc/init.d/FAHClient not creating PID file on start

Post by gordonbb »

davidhcefx wrote: Sat Sep 18, 2021 4:31 pm I think adding a line to the /etc/init.d/FAHClient script might work. But I still hope they could fix it. (Plus make it open source :) )

Code: Select all

@@ -121,6 +121,7 @@ start() {
     fi
 
     pid=$!
+    echo $pid > $PID
     if wait_for_log_change "$LOG_STATUS" $pid; then
         echo "OK"
     else
Thank-you - that does indeed work on Ubuntu 22.04 LTS Desktop. I was getting tired of having to execute

Code: Select all

killall FAHClient
so when I upgraded from 18.04 LTS to 22.04 I did a little digging and found this post.
Image
Post Reply