Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go panic when running convert mbtiles to pmtiles #49

Closed
keichan34 opened this issue Apr 25, 2023 · 3 comments
Closed

Go panic when running convert mbtiles to pmtiles #49

keichan34 opened this issue Apr 25, 2023 · 3 comments

Comments

@keichan34
Copy link

Here are the logs:

2023/04/25 05:38:45 convert.go:362: # of addressed tiles:  5147885
2023/04/25 05:38:45 convert.go:363: # of tile entries (after RLE):  3117056
2023/04/25 05:38:45 convert.go:364: # of tile contents:  2840164
panic: runtime error: index out of range [3117056] with length 3117056
goroutine 1 [running]:
github.com/protomaps/go-pmtiles/pmtiles.build_roots_leaves({0xc021480000, 0x2f9000, 0x35e2aa}, 0x1000)
/Users/bdon/workspace/protomaps/go-pmtiles/pmtiles/directory.go:287 +0x31f
github.com/protomaps/go-pmtiles/pmtiles.optimize_directories({0xc021480000, 0x2f9000, 0x35e2aa}, 0x3f81)
/Users/bdon/workspace/protomaps/go-pmtiles/pmtiles/directory.go:310 +0xad
github.com/protomaps/go-pmtiles/pmtiles.finalize(0xc000186400?, 0xc00011a2a0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...)
/Users/bdon/workspace/protomaps/go-pmtiles/pmtiles/convert.go:376 +0x30e
github.com/protomaps/go-pmtiles/pmtiles.ConvertMbtiles(0xc00063fdc8?, {0xc000124570, 0x24}, {0xc000045ec0, 0x3b}, 0x0?, 0x4?)
/Users/bdon/workspace/protomaps/go-pmtiles/pmtiles/convert.go:353 +0xfa8
github.com/protomaps/go-pmtiles/pmtiles.Convert(0x0?, {0xc000124570?, 0x24?}, {0xc000045ec0?, 0x3b?}, 0x7?, 0x58?)
/Users/bdon/workspace/protomaps/go-pmtiles/pmtiles/convert.go:110 +0x97
main.main()
/Users/bdon/workspace/protomaps/go-pmtiles/main.go:150 +0xb19

I'm currently working on isolating the problem on my end (it could be a malformed mbtiles archive), but at the very least this error should be actionable. The index out of range .. of length is the same number, so maybe there's an off by one bug somewhere? Has anyone run in to this problem?

@bdon
Copy link
Member

bdon commented Apr 25, 2023

It's an off-by-one error; let me work on fixing this and getting out a release

@bdon
Copy link
Member

bdon commented Apr 25, 2023

Released 1.7.1 - can you verify this resolves the issue? https://github.com/protomaps/go-pmtiles/releases/tag/v1.7.1

@keichan34
Copy link
Author

@bdon Works perfectly. Thanks for the quick fix! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants