Unkillable process in "vm map (user)"

Peter Jeremy peter at rulingia.com
Sun Dec 10 20:23:21 UTC 2017


I was experimenting with ports/devel/libmill (which is a library that
provides Go-styly functionality for C programs) and managed to create
an unkillable process by spawning 1000000 "goroutines" (think very
cheap "thread" or "coroutine") joined by "channels" (think message
passing pipes).  (The program ran basically instantaneously with 10000
or 100000 "goroutines", and the Go version has no problems with 1000000
goroutines on a much smaller system).

According to SIGINFO, it's blocked on "vm map (user)" but I can't kill
it.  Can anyone suggest a way to unwedge it?

This is on a system running FreeBSD/amd64 11.1-STABLE r324494.

server% procstat -kk 452
  PID    TID COMM                TDNAME              KSTACK
  452 102382 chain               -                   mi_switch+0x17c sleepq_switch+0x118 sleepq_wait+0x43 _sx_slock_hard+0x34e _sx_slock+0xd4 vm_map_lookup+0xbd vm_fault_hold+0x194b vm_fault+0x75 trap_pfault+0x107 trap+0x382 calltrap+0x8
server% ps -wal -p 452
UID PID  PPID CPU PRI NI       VSZ  RSS MWCHAN   STAT TT     TIME COMMAND
204 452 53567   0  20  0 244064932 2180 vm map ( DL+  13  0:10.31 ./chain 1000000
server% cat src/mill/chain.c
#include <stdio.h>
#include <stdlib.h>
#include <libmill.h>

coroutine void f(chan left, chan right) {
    chs(left, int, 1 + chr(right, int));
}

int main(int argc, char **argv) {
    int i, n = argv[1] ? atoi(argv[1]) : 10000;
    chan leftmost = chmake(int, 0);
    chan left = NULL;
    chan right = leftmost;
    for (i = 0; i < n; i++) {
        left = right;
        right = chmake(int, 0);
        go(f(left, right));
    }
    chs(right, int, 0);
    i = chr(leftmost, int);
    printf("result = %d\n", i);
    return 0;
}
server%

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20171211/d0f0ccf9/attachment.sig>


More information about the freebsd-stable mailing list