bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58631: [Shepherd] Indefinite heap growth (memory leak)


From: Ludovic Courtès
Subject: bug#58631: [Shepherd] Indefinite heap growth (memory leak)
Date: Sat, 22 Oct 2022 22:29:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

An update: I can reproduce in a VM running a slightly simplified version
of ‘hydra/berlin.scm’, with loop running:

  while true; do wget -qO/dev/null http://localhost:3000/nix-cache-info; done

to trigger ‘guix publish’ logging.

Better, I can mostly reproduce the issue with the attached config file,
then starting shepherd:

  rm -f sock && ./shepherd -s sock -c log-conf.scm -I

… monitoring heap usage:

  ./herd -s sock eval root '(gc-stats)'

… and triggering inetd service startup, which in turn triggers heap
growth:

  while : ; do echo foo> /dev/tcp/localhost/4567 ; done

Then the heap size reported by ‘gc-stats’ seems to hit a threshold above
which is stop growing, or it grows too slowly (IOW the problem is not as
easy to observe as on berlin).

That’s pretty much all I have so far.  :-/

Ludo’.

;; https://issues.guix.gnu.org/58631

(define %command
  (list "/bin/sh" "-c"
        (string-append "while true; do "
                       (string-concatenate
                        (make-list 30
                                   (string-append
                                    "echo "
                                    (string-concatenate
                                     (make-list 8 "logging "))
                                    "; ")))
                       "sleep 0.2; "
                       " done")))

(define %echo-server
  ;; Simple echo server.
  '("/bin/sh" "-c" "echo hello; read line; echo line; echo done"))

(define loss
  (make-vector (* 10 (expt 2 20))))

(register-services
 (make <service>
   #:provides '(test-logging)
   #:start (make-forkexec-constructor %command
                                      #:log-file "/tmp/service.log")
   #:stop (make-kill-destructor))
  (make <service>
   #:provides '(test-inetd)
   #:start (make-inetd-constructor %echo-server
                                   (list
                                    (endpoint (make-socket-address
                                               AF_INET
                                               INADDR_LOOPBACK
                                               4567))))
   #:stop  (make-inetd-destructor)))

(start 'test-logging)
(start 'test-inetd)
(pk 'init-gc (gc-stats))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]