SmilyOrg / photofield

Experimental fast photo viewer.
MIT License
402 stars 7 forks source link

panic: determinant of affine transformation matrix is zero #54

Open DawidPietrykowski opened 1 year ago

DawidPietrykowski commented 1 year ago

This is the error I found in logs of the docker container while trying to load a wall of ~95k photos.

Below is the whole stack trace:

photofield-photofield-1  |  panic: determinant of affine transformation matrix is zero
photofield-photofield-1  |  
photofield-photofield-1  |  -> runtime/debug.Stack
photofield-photofield-1  |  ->   /opt/hostedtoolcache/go/1.19.7/x64/src/runtime/debug/stack.go:24
photofield-photofield-1  | 
photofield-photofield-1  |     github.com/go-chi/chi/v5/middleware.PrintPrettyStack
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/middleware/recoverer.go:44
photofield-photofield-1  |     github.com/go-chi/chi/v5/middleware.Recoverer.func1.1
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/middleware/recoverer.go:30
photofield-photofield-1  |     panic
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/runtime/panic.go:884
photofield-photofield-1  |     github.com/tdewolff/canvas.Matrix.Inv
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/tdewolff/canvas@v0.0.0-20200504121106-e2600b35c365/util.go:404
photofield-photofield-1  |     photofield/internal/render.(*Scene).Draw
photofield-photofield-1  |       /home/runner/work/photofield/photofield/internal/render/scene.go:116
photofield-photofield-1  |     main.drawTile
photofield-photofield-1  |       /home/runner/work/photofield/photofield/main.go:216
photofield-photofield-1  |     main.GetScenesSceneIdTilesImpl
photofield-photofield-1  |       /home/runner/work/photofield/photofield/main.go:715
photofield-photofield-1  |     main.(*Api).GetScenesSceneIdTiles
photofield-photofield-1  |       /home/runner/work/photofield/photofield/main.go:627
photofield-photofield-1  |     photofield/internal/openapi.(*ServerInterfaceWrapper).GetScenesSceneIdTiles.func1
photofield-photofield-1  |       /home/runner/work/photofield/photofield/internal/openapi/api.gen.go:892
photofield-photofield-1  |     photofield/internal/openapi.(*ServerInterfaceWrapper).GetScenesSceneIdTiles
photofield-photofield-1  |       /home/runner/work/photofield/photofield/internal/openapi/api.gen.go:899
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*ChainHandler).ServeHTTP
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/chain.go:31
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).routeHTTP
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:442
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).ServeHTTP
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:71
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).Mount.func1
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:314
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).routeHTTP
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:442
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).ServeHTTP
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:71
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).Mount.func1
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:314
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).routeHTTP
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:442
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     github.com/go-chi/chi/v5/middleware.Recoverer.func1
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/middleware/recoverer.go:37
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     main.instrumentationMiddleware.func1
photofield-photofield-1  |       /home/runner/work/photofield/photofield/main.go:114
photofield-photofield-1  |     net/http.HandlerFunc.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2109
photofield-photofield-1  |     github.com/go-chi/chi/v5.(*Mux).ServeHTTP
photofield-photofield-1  |       /home/runner/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.4/mux.go:88
photofield-photofield-1  |     net/http.serverHandler.ServeHTTP
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:2947
photofield-photofield-1  |     net/http.(*conn).serve
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:1991
photofield-photofield-1  |     created by net/http.(*Server).Serve
photofield-photofield-1  |       /opt/hostedtoolcache/go/1.19.7/x64/src/net/http/server.go:3102

Maybe it's just to much photos, but I wanted to experiment with it and see if it would be possible.

Also I must say, it's a great project, I hope to see it grow into something even more powerful!

SmilyOrg commented 1 year ago

Hey, thanks for reporting!

I think this happens for some of the low resolution tiles in bigger collections, so it's pretty reproducible. I think I even saw this before, but ignored it as it's low impact.

But I'll take a look when I get the chance, thanks!

DawidPietrykowski commented 1 year ago

Thanks for the response!

I forgot to add that I don't actually see anything in the browser (except for the settings ui, etc.), but I saw some http errors so I will try to post them when I get a chance.

SmilyOrg commented 1 year ago

Hey, https://github.com/SmilyOrg/photofield/releases/tag/v0.9.3 should include a potential fix for this. Let me know if you still see it!

For the HTTP errors it might be better to open a separate issue :)

barnabyc commented 1 year ago

FWIW am still seeing determinant of affine transformation matrix is zero with 0.10.3