etcd fatal error: failed to reserve page summary memory

220 Views Asked by At

when i try to run etcd from user account (Total RAM: 8GB, virtual memory of 1GB) in a 64 bit Linux environment (limited resources), I am getting the following error:

fatal error: failed to reserve page summary memory

runtime stack:
runtime.throw(
{0x108df50?, 0x7fffd8aa6850?}
)
/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0x7fffd8aa6800 sp=0x7fffd8aa67d0 pc=0x437edd
runtime.(*pageAlloc).sysInit(0x194f2f0)
/usr/local/go/src/runtime/mpagealloc_64bit.go:82 +0x195 fp=0x7fffd8aa6888 sp=0x7fffd8aa6800 pc=0x42c9b5
runtime.(*pageAlloc).init(0x194f2f0, 0x194f2e0, 0x0?)
/usr/local/go/src/runtime/mpagealloc.go:324 +0x70 fp=0x7fffd8aa68b0 sp=0x7fffd8aa6888 pc=0x42a610
runtime.(*mheap).init(0x194f2e0)
/usr/local/go/src/runtime/mheap.go:721 +0x13f fp=0x7fffd8aa68e8 sp=0x7fffd8aa68b0 pc=0x427a3f
runtime.mallocinit()
/usr/local/go/src/runtime/malloc.go:407 +0xb2 fp=0x7fffd8aa6910 sp=0x7fffd8aa68e8 pc=0x40c4f2
runtime.schedinit()
/usr/local/go/src/runtime/proc.go:693 +0xab fp=0x7fffd8aa6970 sp=0x7fffd8aa6910 pc=0x43b8ab
runtime.rt0_go()
/usr/local/go/src/runtime/asm_amd64.s:345 +0x11c fp=0x7fffd8aa6978 sp=0x7fffd8aa6970 pc=0x469c3c

But the same works fine from root account.

Can someone please support?

I was expecting this should give same output from root and user account. This seems like a virtual memory issue to me.

1

There are 1 best solutions below

10
On

As your request isn't very clear, I'm going to share with you a working piece of code that can successfully interact with etcd:

package main

import (
    "context"
    "fmt"
    "time"

    clientv3 "go.etcd.io/etcd/client/v3"
)

func main() {
    cli, err := clientv3.New(clientv3.Config{
        Endpoints:   []string{"localhost:2379"},
        DialTimeout: 5 * time.Second,
    })
    if err != nil {
        panic(err)
    }
    defer cli.Close()

    // insert values
    res, err := cli.Put(context.Background(), "key1", "val1")
    if err != nil {
        panic(err)
    }

    fmt.Printf("revision: %q\n", res.Header.Revision)

    // delete all keys
    defer cli.Delete(context.Background(), "key", clientv3.WithPrefix())

    // get object from etcd
    key, err := cli.Get(context.Background(), "key1")
    if err != nil {
        panic(err)
    }

    fmt.Printf("key: %q\tvalue: %q\n", key.Kvs[0].Key, key.Kvs[0].Value)
}

This code assumes that you've got a running instance of ETCD that listens on port 2379 for incoming requests. I run ETCD with Docker with the following script:
docker run -d -p 2379:2379 -p 2380:2380 --env ALLOW_NONE_AUTHENTICATION=yes --env ETCD_ADVERTISE_CLIENT_URLS=http://etcd-server:2379 bitnami/etcd:latest

Hope this helps in clarifying a little bit!