Subject: bug#39708: closed (Re: bug#39708: nfs-service-type broken: rpc.mountd respawns too quickly)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 08 Mar 2020 14:38:02 +0000

Your bug report

#39708: nfs-service-type broken: rpc.mountd respawns too quickly

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
39708: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39708
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#39708: nfs-service-type broken: rpc.mountd respawns too quickly
From: Maxim Cournoyer <[email-masked]>
To: Ludovic Courtès <[email-masked]>
Cc: [email-masked]
Date: Sun, 08 Mar 2020 10:37:45 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello Ludovic!

Ludovic Courtès <[email-masked]> writes:

> Hi!
>
> Maxim Cournoyer <[email-masked]> skribis:
>
>> I think I've gathered a clue!
>
> [...]
>
>> scheme@(shepherd service)> (make-forkexec-constructor
>>   (list "/gnu/store/qyz1bncxlkxv44c03sva2akfsyqzkzh5-nfs-utils-2.4.2/sbin/rpc.mountd" "--debug" "all"))
>> $5 = #<procedure 7f67f82862a0 at shepherd/service.scm:930:8 args>
>> scheme@(shepherd service)> ($5)
>> $6 = 816
>> scheme@(shepherd service)> (system "pidof rpc.mountd")
>> warning: 'waitpid' -1 failed unexpectedly: No child processes
>> 817
>
> So that means that rpc.mountd “daemonizes”.  Thus, shepherd shouldn’t
> look at the PID of the process it spawns, but rather at what
> rpc.mountd’s PID file contains (I assume it creates a PID file,
> right?).  IOW, we need to pass #:pid-file to ‘make-forkexec-constructor’.

That process doesn't create a PID file, so that doesn't work.

> Does that work for you?
> Thanks for debugging!

Thanks for assisting, and for adding a note to the Shepherd manual! :-)

I'm closing this issue.

Maxim

Subject: nfs-service-type broken: rpc.mountd respawns too quickly
From: Maxim Cournoyer <[email-masked]>
To: bug-guix <[email-masked]>
Date: Thu, 20 Feb 2020 22:58:23 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

The rpc.mountd service, one of the required services for
nfs-service-type, respawns the process quickly until disabled.

Opening the service file,
/ssh:hurd:/gnu/store/qq1dd9rqa2svxhbkpiq6bkpg6dyxwzqb-shepherd-rpc.mountd.scm:

--8<---------------cut here---------------start------------->8---
(eval-when
    (expand load eval)
  (let
      ((extensions
	(quote
	 ()))
       (prepend
	(lambda
	    (items lst)
	  (let loop
	      ((items items)
	       (lst lst))
	    (if
	     (null? items)
	     lst
	     (loop
	      (cdr items)
	      (cons
	       (car items)
	       (delete
		(car items)
		lst))))))))
    (set! %load-path
      (prepend
       (cons "/gnu/store/wy6fvwp3dfrp9frckdascrrb9rvn3h3g-module-import"
	     (map
	      (lambda
		  (extension)
		(string-append extension "/share/guile/site/"
			       (effective-version)))
	      extensions))
       %load-path))
    (set! %load-compiled-path
      (prepend
       (cons "/gnu/store/xd4lwx10ljn902712sphac3k0k97g1vy-module-import-compiled"
	     (map
	      (lambda
		  (extension)
		(string-append extension "/lib/guile/"
			       (effective-version)
			       "/site-ccache"))
	      extensions))
       %load-compiled-path))))
(begin
  (use-modules
   (shepherd service)
   (oop goops)
   (guix build utils)
   (guix build syscalls))
  (make <service> #:docstring
	(quote "Run the NFS mountd daemon.")
	#:provides
	(quote
	 (rpc.mountd))
	#:requires
	(quote
	 (rpc.statd))
	#:one-shot?
	(quote #f)
	#:respawn?
	(quote #t)
	#:start
	(make-forkexec-constructor
	 (list "/gnu/store/c7kpr1jh5z3mrkz0yw9am86851y57cq7-nfs-utils-2.4.2/sbin/rpc.mountd" "--debug" "all"))
	#:stop
	(make-kill-destructor)
	#:actions
	(make-actions)))
--8<---------------cut here---------------end--------------->8---

The process is launched with the equivalent of:

$ /gnu/store/c7kpr1jh5z3mrkz0yw9am86851y57cq7-nfs-utils-2.4.2/sbin/rpc.mountd \
    --debug all

Which doesn't print any output, but returns cleanly.  The process is
daemonized and runs in the background.

Attempting the equivalent using Shepherd yields the same:

scheme@(guix-user)> ,m (shepherd service)
;;; WARNING: loading compiled file /run/current-system/profile/lib/guile/2.2/site-ccache/shepherd/service.go failed:
;;; In procedure load-thunk-from-memory: incompatible bytecode kind

[...]

scheme@(shepherd service)> (make-forkexec-constructor (list "/gnu/store/c7kpr1jh5z3mrkz0yw9am86851y57cq7-nfs-utils-2.4.2/sbin/rpc.mountd" "--debug" "all"))
$1 = #<procedure 7f472f0dbca0 at ice-9/eval.scm:383:13 rest>
scheme@(shepherd service)> ($1)
$2 = 19655

We get back the PID of the rpc.mountd process, and it lives on.

So, I wonder what is causing Shepherd to respawn the process?

Maxim