Go build exits with "signal: killed"

When I run go build on a package (64-bit Linux), I get a strange exit error:

$ go build github.com/blevesearch/segment
go build github.com/blevesearch/segment: /usr/local/go/pkg/tool/linux_amd64/6g: signal: killed

What could be causing this? I’m not sending it a kill signal.

1 Like

I’m going to answer my own question again… :relieved: since it was only this package that was failing, I didn’t bother to Google it. I eventually did anyway, though.

It turns out that the computer ran out of memory. It takes ~1GB of RAM to build that package (!) but I only had 512 MB available. Lifting the memory limit solved the issue.

2 Likes

Check dmesg, look for the linux OOM killer.

This package takes ~650Mb to compile on a 64bit platform

lucky(~/src/github.com/blevesearch/segment) % go build -toolexec '/usr/bin/time -v'
# github.com/blevesearch/segment
        Command being timed: "/home/dfc/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/blevesearch/segment.a -trimpath $WORK -p github.com/blevesearch/segment -complete -buildid 2474ff4e38d423bccd28f59e9abb217446bc5167 -D _/home/dfc/src/github.com/blevesearch/segment -I $WORK -pack ./doc.go ./segment.go ./segment_words.go"
        User time (seconds): 6.74
        System time (seconds): 0.30
        Percent of CPU this job got: 151%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.66
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 651836
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 163553
        Voluntary context switches: 20786
        Involuntary context switches: 939
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

This is most likely caused by the large generated segment_words.go file

% wc -l segment_words.go
173638 segment_words.go
3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.