Open dim opened 9 years ago
can confirm issue and fix
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0xaa pc=0x7f378c89156f]
runtime stack:
runtime.throw(0x55b049308440, 0x2a)
/usr/lib/go-1.6/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
/usr/lib/go-1.6/src/runtime/sigpanic_unix.go:12 +0x5a
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x55b048ffd4c0, 0xc820118290, 0x10000c800000000)
/usr/lib/go-1.6/src/runtime/cgocall.go:123 +0x11b fp=0xc820118258 sp=0xc820118228
github.com/paulsmith/gogeos/geos._Cfunc_GEOSPreparedContains_r(0x55b0498fc900, 0x7f3784001410, 0x7f3784001e58, 0x0)
github.com/paulsmith/gogeos/geos/_obj/_cgo_gotypes.go:1427 +0x3e fp=0xc820118290 sp=0xc820118258
github.com/paulsmith/gogeos/geos.cGEOSPreparedContains(0x7f3784001410, 0x7f3784001e58, 0x3fe0dfffffffff00)
/home/tbonfort/dev/go/src/github.com/paulsmith/gogeos/geos/cwrappers.go:529 +0x188 fp=0xc820118300 sp=0xc820118290
github.com/paulsmith/gogeos/geos.(*PGeometry).predicate(0xc82002a378, 0x55b049245e50, 0x8, 0x55b04935f6c8, 0xc820120850, 0x404588d150889301, 0x0, 0x0)
/home/tbonfort/dev/go/src/github.com/paulsmith/gogeos/geos/prepared.go:95 +0x52 fp=0xc820118378 sp=0xc820118300
github.com/paulsmith/gogeos/geos.(*PGeometry).Contains(0xc82002a378, 0xc820120850, 0x1, 0x0, 0x0)
/home/tbonfort/dev/go/src/github.com/paulsmith/gogeos/geos/prepared.go:37 +0x58 fp=0xc8201183c0 sp=0xc820118378
I seem to be having the same problem when creating geometries from WKT. Anyone have any ideas on a general solution?
I have observed panics when prepared geometry objects are used:
I tried to recreate the behaviour in a test, but I couldn't, at least not consistently. It is related to Go's GC cycles and the finalizer calling
cGEOSGeom_destroy(ptr)
on the original Geometry. As a workaround, I added:It fixes the problem by preventing the Geometry from being garbage-collected, but it is not very elegant.
Thoughts? Thanks