Comments (5)
Environment:
Mac OSX Mavericks
I have geos installed via brew, version 3.4.2
uname -a
Darwin johns-mbp.home 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64
from gogeos.
Looks like it is being caused by point, err := shell.Point(j)
, whic sometimes returns the error Argument is not a LineString
from gogeos.
I can't recreate this, though I only have go 1.4 and the development version (pre-1.5) installed at the moment.
Looks like it might be a race condition with the finalizers being called during a gc.
from gogeos.
And now I am able to recreate it using the -race
flag.
from gogeos.
Hello,
I observed the same problem, on very similar code:
shape, _ := geos.FromWKT(wkt)
box, _ := shape.Envelope()
boundingLine, _ := box.Shell()
geosCoordinates, _ := boundingLine.Coords()
for _, val := range geosCoordinates {
coordinates = append(coordinates, s2.LatLngFromDegrees(val.X, val.Y))
}
Which produces SIGSEGV under heavy load (10 goroutines, database queries, millions of WKT strings). The typical stacktrace was:
[signal 0xb code=0x80 addr=0x0 pc=0x7f726b9f0375]
runtime stack:
runtime.throw(0xa52ae0, 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 103 [syscall, locked to thread]:
runtime.cgocall(0x834dd0, 0xc82013b5b0, 0xc800000000)
/usr/lib/go-1.6/src/runtime/cgocall.go:123 +0x11b fp=0xc82013b560 sp=0xc82013b530
.../vendor/github.com/paulsmith/gogeos/geos._Cfunc_GEOSCoordSeq_getY_r(0x28ae900, 0x7f7238010030, 0x1, 0xc8202700d0, 0x0)
.../vendor/github.com/paulsmith/gogeos/geos/_obj/_cgo_gotypes.go:418 +0x41 fp=0xc82013b5b0 sp=0xc82013b560
.../vendor/github.com/paulsmith/gogeos/geos.cGEOSCoordSeq_getY(0x7f7238010030, 0xc800000001, 0xc8202700d0, 0xc800000000)
.../vendor/github.com/paulsmith/gogeos/geos/cwrappers.go:139 +0x132 fp=0xc82013b610 sp=0xc82013b5b0
.../vendor/github.com/paulsmith/gogeos/geos.(*coordSeq).y(0xc82013b710, 0x1, 0xc114d7e68f5c28f6, 0x0, 0x0)
.../vendor/github.com/paulsmith/gogeos/geos/coordseq.go:93 +0x61 fp=0xc82013b640 sp=0xc82013b610
.../vendor/github.com/paulsmith/gogeos/geos.coordSlice(0xc82013b710, 0x0, 0x0, 0x0, 0x0, 0x0)
.../vendor/github.com/paulsmith/gogeos/geos/coord.go:34 +0x191 fp=0xc82013b6e0 sp=0xc82013b640
.../vendor/github.com/paulsmith/gogeos/geos.(*Geometry).Coords(0xc8202b2fd8, 0x0, 0x0, 0x0, 0x0, 0x0)
.../vendor/github.com/paulsmith/gogeos/geos/geom.go:760 +0x97 fp=0xc82013b720 sp=0xc82013b6e0
As far as I can tell it is an attempt to dereference invalid pointer in C function GEOSCoordSeq_getY_r. Sometimes it was from GEOSCoordSeq_getX_r, several errors were from 'size'-functions. But it is always pointer dereference problem during geos.Coords() call.
As otherwise structures are correct (and I can't reproduce bug if no concurrency involved) my guess was garbage collector, which comes in between calls to geos.FromWKT(wkt)/shape.Envelope()/box.Shell()/boundingLine.Coords() and frees geometries involved in geos.Coords() computations.
To workaround the problem I added silly code to hold variables until after geos.Coords()
geosCoordinates, _ := boundingLine.Coords()
if nil != err {
log.Printf("%d %d %d", shape, box, boundingLine)
}
Surprisingly this worked well. However I would like to see a correct solution to the pointer ownership problem.
from gogeos.
Related Issues (20)
- Panics on prepared geometry calls HOT 2
- Beego Geometry Model Throwing Error (panic: reflect: call of reflect.Value.Interface on zero Value)
- How did you render examples?
- Fixed a bug in encodeWkb() for Windows HOT 2
- Linker error HOT 3
- Segmentation violation (reproducible) HOT 3
- STRTree HOT 2
- cwrappers.go uses *C.void instead of unsafe.Pointer HOT 1
- Implement NearestPoints(g1, g2)
- Geometry.String() results in segmentation violation for MULTIPOLYGON HOT 1
- exit status 3221225781 HOT 2
- go get exited with error HOT 1
- WKT precision encode error
- Buffer options
- Metric format HOT 1
- libc++abi.dylib: Pure virtual function called HOT 1
- geos undefined: coordSeq HOT 1
- OffsetCurve()
- Doesn't work with GOMAXPROCS > 1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gogeos.