consbio / mbtileserver

Basic Go server for mbtiles
ISC License
657 stars 104 forks source link

Crash when issue with one tile #178

Closed philippemiron closed 9 months ago

philippemiron commented 9 months ago

I'm getting the following errors, when trying to start the server:

> /usr/local/bin/mbtileserver_v0.10.0_linux_amd64 --enable-reload-signal -d /home/tiles/

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x853957]

goroutine 1 [running]:
crawshaw.io/sqlite.(*Stmt).Finalize(0x0)
    /go/pkg/mod/crawshaw.io/sqlite@v0.3.3-0.20220618202545-d1964889ea3c/sqlite.go:556 +0x17
github.com/brendan-ward/mbtiles-go.validateRequiredTables(0xc0002296d0?)
    /go/pkg/mod/github.com/brendan-ward/mbtiles-go@v0.1.1-0.20230310232339-6c48cea51706/mbtiles.go:277 +0x143
github.com/brendan-ward/mbtiles-go.Open({0xc0002296d0, 0x46})
    /go/pkg/mod/github.com/brendan-ward/mbtiles-go@v0.1.1-0.20230310232339-6c48cea51706/mbtiles.go:77 +0x270
github.com/consbio/mbtileserver/handlers.newTileset(0xc0001f1220, {0xc0002296d0, 0x46}, {0xc0002296f4, 0x1a}, {0xc00028ab70, 0x24})
    /go/src/github.com/consbio/mbtileserver/handlers/tileset.go:34 +0x65
github.com/consbio/mbtileserver/handlers.(*ServiceSet).AddTileset(0xc0001f1220, {0xc0002296d0, 0x46}, {0xc0002296f4, 0x1a})
    /go/src/github.com/consbio/mbtileserver/handlers/serviceset.go:73 +0xa6
main.serve()
    /go/src/github.com/consbio/mbtileserver/main.go:327 +0x2358
main.glob..func1(0xc0000ec600?, {0xa53189?, 0x4?, 0xa5318d?})
    /go/src/github.com/consbio/mbtileserver/main.go:52 +0xaa
github.com/spf13/cobra.(*Command).execute(0xf51200, {0xc000024080, 0x6, 0x6})
    /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x863
github.com/spf13/cobra.(*Command).ExecuteC(0xf51200)
    /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
    /go/src/github.com/consbio/mbtileserver/main.go:214 +0x1a

I haven't managed to identify what is the underlying issue with the tiles, they seem normal as far as I can see, but it would be nice if mbtileserver could skip the tile instead of crashing.

brendan-ward commented 9 months ago

Agreed - crashing is bad! However, in order to try and patch in a fix I'd need something that can reproduce this exact error. Is there a subset of your tileset that still produces this error that you can share, either publicly by uploading to this issue, or via email (see my profile).

Since the failure looks to be in the bindings against C code, we may not be able to prevent the process from segfaulting though.

philippemiron commented 9 months ago

I saw your message but don't have a tile to share at the moment. Next time it happens I will gather logs and share with you.

Thanks for your answer.

philippemiron commented 9 months ago

Hi, I think we can close this for now. I believe it was a problem with syncing tiles to the ec2 instance, and not mbtileserver. I modified this timing and I'm not seeing issues anymore.

philippemiron commented 9 months ago

Hi, I think we can cancel. I believe it was an problem with syncing tiles to the ec2 instance. I modified this timing and I'm not seeing issues anymore.