andig / gravo

Grafana for Volkszaehler
https://volkszaehler.org
MIT License
15 stars 10 forks source link

gravo container seems to crash unexpected #8

Closed oriziena closed 4 years ago

oriziena commented 4 years ago

hi, frist of all thanks for your work. my docker container seems to crash sometimes giving following log output:

normal output....

2020/01/30 22:01:53 Running gravo v0.3.0 (3032543) 2020/01/30 22:01:53 GET http://10.0.0.20:8888/middleware.php/entity.json (34ms) 2020/01/30 22:02:03 GET http://10.0.0.20:8888/middleware.php/data/94eabf40-0dac-11e7-bb8c-3189e14aad83.json?from=1580335330000&to=1580421730000&tuples=840 (650ms) 2020/01/30 22:02:03 GET http://10.0.0.20:8888/middleware.php/data/a350c6e0-0dac-11e7-a861-39fa0c4ee186.json?from=1580335330000&to=1580421730000&tuples=840 (758ms) 2020/01/30 22:02:03 POST /query (776ms)

crashing stuff....

2020/01/30 22:00:55 GET http://10.0.0.20:8888/middleware.php/entity.json (26ms) 2020/01/30 22:00:55 GET http://10.0.0.20:8888/middleware.php/entity.json (26ms) fatal error: concurrent map writes fatal error: concurrent map writes

goroutine 1217 [running]: runtime.throw(0x72d278, 0x15) /usr/local/go/src/runtime/panic.go:617 +0x72 fp=0xc0001b9630 sp=0xc0001b9600 pc=0x42d5a2 runtime.mapassign_faststr(0x6c90e0, 0xc0000fac00, 0xc000082630, 0x24, 0x9aef40) /usr/local/go/src/runtime/map_faststr.go:291 +0x40f fp=0xc0001b9698 sp=0xc0001b9630 pc=0x41434f main.(Server).populateCache(0xc00000e2c0, 0xc000464000, 0x17, 0x20) /go/src/github.com/andig/gravo/server.go:119 +0x198 fp=0xc0001b9788 sp=0xc0001b9698 pc=0x6837e8 main.(Server).getPublicEntites(0xc00000e2c0, 0xc00022e4e0, 0x16, 0x0) /go/src/github.com/andig/gravo/server.go:134 +0x15e fp=0xc0001b97f8 sp=0xc0001b9788 pc=0x6839de main.(Server).executeSearch(0xc00000e2c0, 0x6aa6e0, 0xc00022e4e0, 0x0) /go/src/github.com/andig/gravo/server.go:139 +0x43 fp=0xc0001b9920 sp=0xc0001b97f8 pc=0x683a63 main.(Server).searchHandler(0xc00000e2c0, 0x792f40, 0xc000194380, 0xc00023c700) /go/src/github.com/andig/gravo/server.go:89 +0x224 fp=0xc0001b9a18 sp=0xc0001b9920 pc=0x683004 main.(Server).searchHandler-fm(0x792f40, 0xc000194380, 0xc00023c700) /go/src/github.com/andig/gravo/server.go:81 +0x48 fp=0xc0001b9a48 sp=0xc0001b9a18 pc=0x6864a8 main.logger.func1(0x792f40, 0xc000194380, 0xc00023c700) /go/src/github.com/andig/gravo/handler.go:52 +0xc8 fp=0xc0001b9ba0 sp=0xc0001b9a48 pc=0x685438 main.allowed.func1(0x792f40, 0xc000194380, 0xc00023c700) /go/src/github.com/andig/gravo/handler.go:25 +0x10a fp=0xc0001b9bf8 sp=0xc0001b9ba0 pc=0x68535a main.cors.func1(0x792f40, 0xc000194380, 0xc00023c700) /go/src/github.com/andig/gravo/handler.go:17 +0x2ea fp=0xc0001b9c68 sp=0xc0001b9bf8 pc=0x6851da net/http.HandlerFunc.ServeHTTP(0xc0001061c0, 0x792f40, 0xc000194380, 0xc00023c700) /usr/local/go/src/net/http/server.go:1995 +0x44 fp=0xc0001b9c90 sp=0xc0001b9c68 pc=0x634624 net/http.(ServeMux).ServeHTTP(0x9917c0, 0x792f40, 0xc000194380, 0xc00023c700) /usr/local/go/src/net/http/server.go:2375 +0x1d6 fp=0xc0001b9cf0 sp=0xc0001b9c90 pc=0x636526 net/http.serverHandler.ServeHTTP(0xc00011e340, 0x792f40, 0xc000194380, 0xc00023c700) /usr/local/go/src/net/http/server.go:2774 +0xa8 fp=0xc0001b9d20 sp=0xc0001b9cf0 pc=0x637388 net/http.(conn).serve(0xc0003d20a0, 0x7935c0, 0xc0000a9e40) /usr/local/go/src/net/http/server.go:1878 +0x851 fp=0xc0001b9fc8 sp=0xc0001b9d20 pc=0x6337d1 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0001b9fd0 sp=0xc0001b9fc8 pc=0x459141 created by net/http.(Server).Serve /usr/local/go/src/net/http/server.go:2884 +0x2f4

goroutine 1 [IO wait, 2 minutes]: internal/poll.runtime_pollWait(0x7fe143951f38, 0x72, 0x0) /usr/local/go/src/runtime/netpoll.go:182 +0x56 internal/poll.(pollDesc).wait(0xc00013e018, 0x72, 0x0, 0x0, 0x72919e) /usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b internal/poll.(pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(FD).Accept(0xc00013e000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:384 +0x1ba net.(netFD).accept(0xc00013e000, 0xc000018070, 0xc000018000, 0x40d0c9) /usr/local/go/src/net/fd_unix.go:238 +0x42 net.(TCPListener).accept(0xc00011c070, 0xc0001cdd38, 0x83da38ee, 0x949e9301b2b9b297) /usr/local/go/src/net/tcpsock_posix.go:139 +0x32 net.(TCPListener).AcceptTCP(0xc00011c070, 0xc0001cdd60, 0x47d6c6, 0x5e3351d2) /usr/local/go/src/net/tcpsock.go:247 +0x48 net/http.tcpKeepAliveListener.Accept(0xc00011c070, 0xc0001cddb0, 0x18, 0xc000000180, 0x637834) /usr/local/go/src/net/http/server.go:3264 +0x2f net/http.(Server).Serve(0xc00011e340, 0x793100, 0xc00011c070, 0x0, 0x0) /usr/local/go/src/net/http/server.go:2859 +0x22d net/http.(Server).ListenAndServe(0xc00011e340, 0xc00011e340, 0xb) /usr/local/go/src/net/http/server.go:2797 +0xe4 net/http.ListenAndServe(...) /usr/local/go/src/net/http/server.go:3037 main.main() /go/src/github.com/andig/gravo/main.go:44 +0x607

goroutine 1265 [runnable]: net/http.setRequestCancel.func3(0x0, 0xc000182a80, 0xc000188500, 0xc000374310, 0xc00019a960) /usr/local/go/src/net/http/client.go:321 +0xcf created by net/http.setRequestCancel /usr/local/go/src/net/http/client.go:320 +0x251

goroutine 1183 [running]: goroutine running on other thread; stack unavailable created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:2884 +0x2f4

goroutine 1233 [IO wait]: internal/poll.runtime_pollWait(0x7fe143951718, 0x72, 0xffffffffffffffff) /usr/local/go/src/runtime/netpoll.go:182 +0x56 internal/poll.(pollDesc).wait(0xc000246018, 0x72, 0x0, 0x1, 0xffffffffffffffff) /usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b internal/poll.(pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(FD).Read(0xc000246000, 0xc000210191, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b net.(netFD).Read(0xc000246000, 0xc000210191, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/go/src/net/fd_unix.go:202 +0x4f net.(conn).Read(0xc000240008, 0xc000210191, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x69 net/http.(connReader).backgroundRead(0xc000210180) /usr/local/go/src/net/http/server.go:677 +0x58 created by net/http.(*connReader).startBackgroundRead /usr/local/go/src/net/http/server.go:673 +0xca

goroutine 1264 [IO wait]: internal/poll.runtime_pollWait(0x7fe143951a58, 0x72, 0xffffffffffffffff) /usr/local/go/src/runtime/netpoll.go:182 +0x56 internal/poll.(pollDesc).wait(0xc000196298, 0x72, 0x0, 0x1, 0xffffffffffffffff) /usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b internal/poll.(pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(FD).Read(0xc000196280, 0xc000182671, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b net.(netFD).Read(0xc000196280, 0xc000182671, 0x1, 0x1, 0xc0000a9e98, 0xc00032cf68, 0x46003d) /usr/local/go/src/net/fd_unix.go:202 +0x4f net.(conn).Read(0xc00011c090, 0xc000182671, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:177 +0x69 net/http.(connReader).backgroundRead(0xc000182660) /usr/local/go/src/net/http/server.go:677 +0x58 created by net/http.(*connReader).startBackgroundRead /usr/local/go/src/net/http/server.go:673 +0xca

goroutine 1183 [running]: runtime.throw(0x72d278, 0x15) /usr/local/go/src/runtime/panic.go:617 +0x72 fp=0xc0001bb630 sp=0xc0001bb600 pc=0x42d5a2 runtime.mapassign_faststr(0x6c90e0, 0xc0000fac00, 0xc000336540, 0x24, 0x9aef40) /usr/local/go/src/runtime/map_faststr.go:291 +0x40f fp=0xc0001bb698 sp=0xc0001bb630 pc=0x41434f main.(Server).populateCache(0xc00000e2c0, 0xc000460000, 0x17, 0x20) /go/src/github.com/andig/gravo/server.go:119 +0x198 fp=0xc0001bb788 sp=0xc0001bb698 pc=0x6837e8 main.(Server).getPublicEntites(0xc00000e2c0, 0xc000106410, 0x16, 0x0) /go/src/github.com/andig/gravo/server.go:134 +0x15e fp=0xc0001bb7f8 sp=0xc0001bb788 pc=0x6839de main.(Server).executeSearch(0xc00000e2c0, 0x6aa6e0, 0xc000106410, 0x0) /go/src/github.com/andig/gravo/server.go:139 +0x43 fp=0xc0001bb920 sp=0xc0001bb7f8 pc=0x683a63 main.(Server).searchHandler(0xc00000e2c0, 0x792f40, 0xc00049a1c0, 0xc0003d0400) /go/src/github.com/andig/gravo/server.go:89 +0x224 fp=0xc0001bba18 sp=0xc0001bb920 pc=0x683004 main.(Server).searchHandler-fm(0x792f40, 0xc00049a1c0, 0xc0003d0400) /go/src/github.com/andig/gravo/server.go:81 +0x48 fp=0xc0001bba48 sp=0xc0001bba18 pc=0x6864a8 main.logger.func1(0x792f40, 0xc00049a1c0, 0xc0003d0400) /go/src/github.com/andig/gravo/handler.go:52 +0xc8 fp=0xc0001bbba0 sp=0xc0001bba48 pc=0x685438 main.allowed.func1(0x792f40, 0xc00049a1c0, 0xc0003d0400) /go/src/github.com/andig/gravo/handler.go:25 +0x10a fp=0xc0001bbbf8 sp=0xc0001bbba0 pc=0x68535a main.cors.func1(0x792f40, 0xc00049a1c0, 0xc0003d0400) /go/src/github.com/andig/gravo/handler.go:17 +0x2ea fp=0xc0001bbc68 sp=0xc0001bbbf8 pc=0x6851da net/http.HandlerFunc.ServeHTTP(0xc0001061c0, 0x792f40, 0xc00049a1c0, 0xc0003d0400) /usr/local/go/src/net/http/server.go:1995 +0x44 fp=0xc0001bbc90 sp=0xc0001bbc68 pc=0x634624 net/http.(ServeMux).ServeHTTP(0x9917c0, 0x792f40, 0xc00049a1c0, 0xc0003d0400) /usr/local/go/src/net/http/server.go:2375 +0x1d6 fp=0xc0001bbcf0 sp=0xc0001bbc90 pc=0x636526 net/http.serverHandler.ServeHTTP(0xc00011e340, 0x792f40, 0xc00049a1c0, 0xc0003d0400) /usr/local/go/src/net/http/server.go:2774 +0xa8 fp=0xc0001bbd20 sp=0xc0001bbcf0 pc=0x637388 net/http.(conn).serve(0xc000286000, 0x7935c0, 0xc00028a000) /usr/local/go/src/net/http/server.go:1878 +0x851 fp=0xc0001bbfc8 sp=0xc0001bbd20 pc=0x6337d1 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0001bbfd0 sp=0xc0001bbfc8 pc=0x459141 created by net/http.(Server).Serve /usr/local/go/src/net/http/server.go:2884 +0x2f4

andig commented 4 years ago

Thank you, should be fixed in 56ecb7b425e7309cba8c8e674ec40d432a236108, build is running right now.

oriziena commented 4 years ago

@andig sorry for this dump question... how to update the docker container ?

sudo docker pull andig/gravo Using default tag: latest latest: Pulling from andig/gravo Digest: sha256:9690ce565d765570a29b157c92c921fcc75d08cce67f9fe439ee0471b252ef25 Status: Image is up to date for andig/gravo:latest docker.io/andig/gravo:latest

andig commented 4 years ago

It‘s all here, updated this morning: https://hub.docker.com/layers/andig/gravo/latest/images/sha256-6ac84df8c108dce396c4f83ba1372b78ce900258bb9df1c11e9df4524ee9d58b

oriziena commented 4 years ago

sorry to disturb you again... but docker pull still receives old image...

xyz@mycloud ~ % sudo docker pull andig/gravo Using default tag: latest latest: Pulling from andig/gravo Digest: sha256:9690ce565d765570a29b157c92c921fcc75d08cce67f9fe439ee0471b252ef25 Status: Image is up to date for andig/gravo:latest docker.io/andig/gravo:latest xyz@mycloud ~ % date Mon Feb 3 21:00:53 CET 2020

whats wrong ?

andig commented 4 years ago

Not sure. Are you saying it still doesn't work? If not- could you run from source instead of using docker?

oriziena commented 4 years ago

nope ...

make already fails with this lines: root@mycloud /opt/gravo (git)-[master] # make rm -rf dist/ cover.out golangci-lint run WARN Failed to discover go env: failed to run 'go env': exit status 2 ERRO Running error: context loading failed: failed to load program with go/packages: unsupported version of go: exit status 2: flag provided but not defined: -compiled usage: list [-e] [-f format] [-json] [build flags] [packages]

List lists the packages named by the import paths, one per line.

The default output shows the package import path:

bytes
encoding/json
github.com/gorilla/mux
golang.org/x/net/html

installed go version go version go1.6.2 linux/amd64

oriziena commented 4 years ago

i am also confused... I reinstalled gravo again...

docker still puls v.0.3.0?

anzimber@mycloud ~ % sudo docker run -p 8000:8000 andig/gravo:latest -api http://10.0.0.20:8888/middleware.php Unable to find image 'andig/gravo:latest' locally latest: Pulling from andig/gravo bdf0201b3a05: Already exists 723b4e27af3c: Pull complete 1c69da7cafe0: Pull complete c228abed51e6: Pull complete 0581746de46d: Pull complete Digest: sha256:9690ce565d765570a29b157c92c921fcc75d08cce67f9fe439ee0471b252ef25 Status: Downloaded newer image for andig/gravo:latest 2020/02/04 19:26:47 Running gravo v0.3.0 (3032543) 2020/02/04 19:26:47 GET http://10.0.0.20:8888/middleware.php/entity.json (44ms)

andig commented 4 years ago

go version go1.6.2 linux/amd64

...that's from the last decade. You'll need 1.13.

oriziena commented 4 years ago

woah ... i am golang noob... sorry for that :)

finally its running locally with latest 'master"

thanks!

andig commented 4 years ago

I've also released a new version now, hope this one's working...