tidwall / tile38

Real-time Geospatial and Geofencing
https://tile38.com
MIT License
9.13k stars 569 forks source link

tile38-server crash with fence ROAM #440

Closed githubfr closed 5 years ago

githubfr commented 5 years ago

I am new to tile38 and tried the following:

in terminal window1 127.0.0.1:9851> SET group p1 POINT 58 60 {"ok":true,"elapsed":"9.754µs"} 127.0.0.1:9851> SET group p2 POINT 60 60 {"ok":true,"elapsed":"6.6µs"} 127.0.0.1:9851> SET group p3 POINT 62 60 {"ok":true,"elapsed":"12.192µs"}

in terminal window2 tile38-cli 127.0.0.1:9851> {Y visitors MATCH v LIMIT 5 DISTANCE fence ROAM group * 200000 {"ok":true,"live":true}

in terminal window1 127.0.0.1:9851> SET visitors v POINT 59 60 {"ok":true,"elapsed":"14.286µs"}

-> result is a crash of tile38-server, with the following messages:

2019/04/14 15:19:35 [INFO] Server started, Tile38 version 1.16.1, git 0000000 2019/04/14 15:19:35 [INFO] AOF loaded 103 commands: 0.00s, 232018/s, 16 MB/s 2019/04/14 15:19:35 [INFO] Ready to accept connections at [::]:9851 2019/04/14 15:21:01 [INFO] live 127.0.0.1:50573 2019/04/14 15:25:59 [INFO] not live 127.0.0.1:50573 2019/04/14 15:26:58 [INFO] live 127.0.0.1:50584 2019/04/14 15:27:04 [INFO] not live 127.0.0.1:50584 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x1479e12]

goroutine 47 [running]: github.com/tidwall/tile38/vendor/github.com/tidwall/geojson.(Point).Distance(0xc0001937a0, 0x0, 0x0, 0x8) /var/folders/kw/j7f63hdn1lj39702nh90xm9w0000gp/T/tile38.XXXX.Ka2VFxjH/go/src/github.com/tidwall/tile38/vendor/github.com/tidwall/geojson/point.go:225 +0x22 github.com/tidwall/tile38/internal/server.fenceMatch(0x0, 0x0, 0xc000278f00, 0xc00021a140, 0x0, 0x0, 0x0, 0xc00011a000, 0xc000040500, 0xc000093a70, ...) /var/folders/kw/j7f63hdn1lj39702nh90xm9w0000gp/T/tile38.XXXX.Ka2VFxjH/go/src/github.com/tidwall/tile38/internal/server/fence.go:174 +0x1845 github.com/tidwall/tile38/internal/server.FenceMatch(0x0, 0x0, 0xc000278f00, 0xc00021a140, 0x0, 0x0, 0x0, 0xc00011a000, 0x9e400, 0xc0000bb310, ...) /var/folders/kw/j7f63hdn1lj39702nh90xm9w0000gp/T/tile38.XXXX.Ka2VFxjH/go/src/github.com/tidwall/tile38/internal/server/fence.go:17 +0x9b github.com/tidwall/tile38/internal/server.(Server).goLive.func4(0xc0001fa580, 0xc000093c18, 0xc00021a140, 0xc00011a000, 0xc00010dc88) /var/folders/kw/j7f63hdn1lj39702nh90xm9w0000gp/T/tile38.XXXX.Ka2VFxjH/go/src/github.com/tidwall/tile38/internal/server/live.go:189 +0xa8 github.com/tidwall/tile38/internal/server.(Server).goLive(0xc0001fa580, 0x1a9a800, 0xc00021a000, 0x1ab55c0, 0xc0000a6820, 0xc00043a040, 0xc0000bb280, 0x0, 0x0, 0x0)/var/folders/kw/j7f63hdn1lj39702nh90xm9w0000gp/T/tile38.XXXX.Ka2VFxjH/go/src/github.com/tidwall/tile38/internal/server/live.go:190 +0x93e github.com/tidwall/tile38/internal/server.(Server).netServe.func1.2(0xc00009e194, 0xc0001fa580, 0xc00043a000, 0x1ab5860, 0xc000214000, 0x26d1308, 0xc000214000) /var/folders/kw/j7f63hdn1lj39702nh90xm9w0000gp/T/tile38.XXXX.Ka2VFxjH/go/src/github.com/tidwall/tile38/internal/server/server.go:629 +0x141 created by github.com/tidwall/tile38/internal/server.(*Server).netServe.func1 /var/folders/kw/j7f63hdn1lj39702nh90xm9w0000gp/T/tile38.XXXX.Ka2VFxjH/go/src/github.com/tidwall/tile38/internal/server/server.go:627 +0xb52

I hope it is just a mishandling from me. Thank you for your help.

tidwall commented 5 years ago

Thank you so much for reporting this bug. I just pushed an update

githubfr commented 5 years ago

hello,

first, thank you very much for your work! Tile38 is a very good project!

For now your update didn’t solve the problem. It still crash.

I hope i use the good release : Tile38 version 1.16.4

2019/04/25 14:28:35 [INFO] Server started, Tile38 version 1.16.4, git 96dc1d4 2019/04/25 14:28:35 [INFO] AOF loaded 121 commands: 0.00s, 152884/s, 10 MB/s 2019/04/25 14:28:35 [INFO] Ready to accept connections at [::]:9851 2019/04/25 14:29:19 [INFO] live 127.0.0.1:52523 2019/04/25 14:29:30 [INFO] not live 127.0.0.1:52523 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x1452b82]

goroutine 53 [running]: github.com/tidwall/tile38/vendor/github.com/tidwall/geojson.(*Point).Distance(0xc000411040, 0x0, 0x0, 0x8) /var/folders/b9/8yjpvz452_q0nrfy7cf1yb2w0000gn/T/tile38.XXXX.eW6rI20G/go/src/github.com/tidwall/tile38/vendor/github.com/tidwall/geojson/point.go:237 +0x22 github.com/tidwall/tile38/internal/server.fenceMatch(0x0, 0x0, 0xc000076f00, 0xc0004b4140, 0x0, 0x0, 0x0, 0xc00015a960, 0x102c41c, 0xc000442a38, ...) /var/folders/b9/8yjpvz452_q0nrfy7cf1yb2w0000gn/T/tile38.XXXX.eW6rI20G/go/src/github.com/tidwall/tile38/internal/server/fence.go:174 +0x14be

I don’t know go at all, but i can follow the crash trace.

//here is where you have modified the code because of this bug fence.go if fence.distance && fence.obj != nil { distance = details.obj.Distance(fence.obj) }

//and here is the final trace, where the crash occur point.go // Distance ... func (g *Point) Distance(obj Object) float64 { return obj.Spatial().DistancePoint(g.base) }

Maybe details.obj could be nil?

Le 23 avr. 2019 à 20:19, Josh Baker notifications@github.com a écrit :

Thank you so much for reporting this bug. I just pushed an update

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

tidwall commented 5 years ago

The fix is only in the master branch atm. I’ll be pushing a new version release this week. With Docker you can see the fix by using the edge tag, or by manually building Tile38.