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

Tilenol crashes with nil pointer exception #39

Closed
audreyyku opened this issue Jan 29, 2021 · 1 comment · Fixed by #44
Closed

Tilenol crashes with nil pointer exception #39

audreyyku opened this issue Jan 29, 2021 · 1 comment · Fixed by #44
Labels
bug Something isn't working
Milestone

Comments

@audreyyku
Copy link

Describe the bug
Tilenol crashes upon nil exception, however this bug is unpredictably reproducible.
The main problem with this bug is the uncertainty of how and when it will occur and that it causes tilenol to stop running entirely.

To Reproduce
Line run right prior to error (in tilenol/examples/postgis):

../../target/tilenol run -x -d

When rendering the locally hosted tilenol via a local html file, tilenol works as expected, but at some point in time crashes with nil pointer dereference.

Hypothesized causes:

  • Idle session timeout
  • Refreshing page
  • Panning across tiles too rapidly
  • Underlying TxDatabase libraries being source of error

Stack trace:

...
INFO[0018] [...] "GET http://localhost:3000/list-locations/11/620/758.mvt?q=list_id%20%3D%20%2701EG4NCCHP5PJF4NHE2P4MV7V8%27 HTTP/1.1" from [::1]:58250 - 200 47B in 10.037610166s
panic: runtime error: invalid memory address or nil pointer dereference
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1569646]

goroutine 947 [running]:
github.com/doug-martin/goqu/v9.(*TxDatabase).Trace(0x0, 0x18f5626, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0)
	/.../go/pkg/mod/github.com/doug-martin/goqu/[email protected]/database.go:493 +0x26
github.com/doug-martin/goqu/v9.(*TxDatabase).Rollback(0x0, 0x9, 0x0)
	/.../go/pkg/mod/github.com/doug-martin/goqu/[email protected]/database.go:605 +0x56
panic(0x1806040, 0x1e601d0)
	/usr/local/go/src/runtime/panic.go:969 +0x1b9
github.com/doug-martin/goqu/v9.(*TxDatabase).Trace(0x0, 0x18f2154, 0x5, 0xc000554000, 0x6c8, 0x0, 0x0, 0x0)
	/.../go/pkg/mod/github.com/doug-martin/goqu/[email protected]/database.go:493 +0x26
github.com/doug-martin/goqu/v9.(*TxDatabase).QueryContext(0x0, 0x19d53a0, 0xc0000b4008, 0xc000554000, 0x6c8, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/.../go/pkg/mod/github.com/doug-martin/goqu/[email protected]/database.go:535 +0x85
github.com/doug-martin/goqu/v9.(*TxDatabase).Query(...)
	/.../go/pkg/mod/github.com/doug-martin/goqu/[email protected]/database.go:530
github.com/stationa/tilenol.(*PostGISSource).runQuery(0xc0001cfa70, 0x19d5360, 0xc00020e600, 0xc000554000, 0x6c8, 0x0, 0x0, 0x0, 0x0, 0x0)
	/.../dev/src/github.com/stationa/tilenol/postgis_source.go:206 +0x21a
github.com/stationa/tilenol.(*PostGISSource).GetFeatures(0xc0001cfa70, 0x19d5360, 0xc00020e600, 0xc00060c060, 0xc00027ff28, 0x4, 0x4)
	/.../dev/src/github.com/stationa/tilenol/postgis_source.go:250 +0x325
github.com/stationa/tilenol.(*Server).getVectorTile.func1(0x0, 0x0)
	/.../dev/src/github.com/stationa/tilenol/server.go:270 +0x223
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0004f4240, 0xc00041c0a0)
	/.../go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x59
created by golang.org/x/sync/errgroup.(*Group).Go
	/.../go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66

Note: When running the following script to re-run all the requests from the stack trace above (sequentially), there were no errors.

cat tilenol_logs.txt | grep OPTIONS | cut -d" " -f 4 | xargs curl --compressed -v

Expected behavior
Tilenol runs without crashing.

Desktop (please complete the following information):

  • OS: macOS Big Sur
  • Browser: Chrome
  • Version: 11.1
@jerluc jerluc added the bug Something isn't working label Feb 1, 2021
@jerluc
Copy link
Member

jerluc commented Feb 4, 2021

Just wanted to add that I was also able to by chance reproduce this same issue on my Linux desktop, which mostly throws out the suspicion that this is platform-specific:

  • OS: Pop!_OS 20.10
  • Browser: Chrome
  • Version: 88.0.4324.96 (Official Build) (64-bit)

That said, it is very tricky to reproduce, but seems to have only recently popped up with the introduction of the PostGIS source, and seems to also correspond with quickly moving around the map. This makes me think that possibly the PostGIS source implementation does not respond well to request cancellations (see #42), which are a common occurrence when panning quickly on the map, and as a result, this can sometimes panic under certain conditions.

@jerluc jerluc added this to the v1.1.0 milestone Feb 4, 2021
@jerluc jerluc linked a pull request Feb 9, 2021 that will close this issue
@ccma14 ccma14 closed this as completed in #44 Feb 9, 2021
ccma14 added a commit that referenced this issue Feb 9, 2021
This change resolves issue #39, which is a case that gets hit if a tile request is canceled while we are still processing the BeginTx call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants