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

GEOS: panic for single MULTIPOLYGON within a GEOMETRYCOLLECTION #53254

Closed
cockroach-teamcity opened this issue Aug 22, 2020 · 8 comments · Fixed by #53907
Closed

GEOS: panic for single MULTIPOLYGON within a GEOMETRYCOLLECTION #53254

cockroach-teamcity opened this issue Aug 22, 2020 · 8 comments · Fixed by #53907
Assignees
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot.
Milestone

Comments

@cockroach-teamcity
Copy link
Member

cockroach-teamcity commented Aug 22, 2020

Issue filed: https://trac.osgeo.org/geos/ticket/1047

GEOS crash:

select st_asewkt(st_union(g::geometry)) from ( values ('010700000003000000010200000004000000524dc13b1bc6eac760e592f6a1439cc786722c8b4ba0e5c720e011036f75b1c73657d16c0470eac71c64e5424c8ddec7fcecc6a3254fc5c7626f2ac8641bddc7010100000070095a4654f3c147807e767db5c0d4c70101000000dae66a3c3403e5c77c0361722b6ce047'), ('0107000000010000000106000000010000000103000000010000000500000008690b3a70a9c347540a11d15993eec7e04b9e4d8fd2cb4702907c2929abe847d02aef5652e3cec72c1b57867da3dd47bbf47698d501eac7ccc0d287b380d44708690b3a70a9c347540a11d15993eec7') ) tbl(g);


goroutine 1847 [syscall]:
_ZN4geos9algorithm6locate24SimplePointInAreaLocator20locatePointInPolygonERKNS_4geom10CoordinateEPKNS3_7PolygonE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135d8df5
_ZN4geos9geomgraph11EdgeEndStar11getLocationEiRKNS_4geom10CoordinateEPNSt3__16vectorIPNS0_13GeometryGraphENS6_9allocatorIS9_EEEE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135ffd18
_ZN4geos9geomgraph11EdgeEndStar16computeLabellingEPNSt3__16vectorIPNS0_13GeometryGraphENS2_9allocatorIS5_EEEE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135ff966
_ZN4geos9geomgraph16DirectedEdgeStar16computeLabellingEPNSt3__16vectorIPNS0_13GeometryGraphENS2_9allocatorIS5_EEEE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135fbdef
_ZN4geos9operation7overlay9OverlayOp16computeLabellingEv
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x13658a4e
_ZN4geos9operation7overlay9OverlayOp14computeOverlayENS2_6OpCodeE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x13657da4
_ZN4geos9operation7overlay9OverlayOp9overlayOpEPKNS_4geom8GeometryES6_NS2_6OpCodeE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x1365746f
_ZN4geos4geom8BinaryOpINS_9operation7overlay9overlayOpEEENSt3__110unique_ptrINS0_8GeometryENS5_14default_deleteIS7_EEEEPKS7_SC_T_
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135e1111
_ZNK4geos4geom8Geometry5UnionEPKS1_
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135e1db3
GEOSUnion_r
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos_c.dylib:0 pc=0x11fcbf22
CR_GEOS_Union
	/Users/otan/go/src/github.com/cockroachdb/cockroach/./cockroach:0 pc=0x7639e61
_cgo_30d17c8bd544_Cfunc_CR_GEOS_Union
	/Users/otan/go/src/github.com/cockroachdb/cockroach/./cockroach:0 pc=0x76364e2
runtime.cgocall(0x76364b0, 0xc0015dd378, 0x4000001)

(sql/distsql).TestAggregatorAgainstProcessor failed on master@7ac3e989c9dbb5c9ff51b4b33e2cee63328a6496:

	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 340 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x55f52a0, 0xc000f56930)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0x76
runtime/pprof.Do(0x55f52a0, 0xc000f56930, 0xc0004f2cc0, 0x1, 0x1, 0xc000e7d7b8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0009dcc98)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 341 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x55f52a0, 0xc000f56990)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0x76
runtime/pprof.Do(0x55f52a0, 0xc000f56990, 0xc0004f2cc0, 0x1, 0x1, 0xc000e7ffb8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0009dcd90)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 342 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x55f52a0, 0xc000d75470)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0x76
runtime/pprof.Do(0x55f52a0, 0xc000d75470, 0xc0004f2cc0, 0x1, 0x1, 0xc00138d7b8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0009dce88)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 343 [sync.Cond.Wait]:
runtime.goparkunlock(...)
	/usr/local/go/src/runtime/proc.go:310
sync.runtime_notifyListWait(0xc0009f80e0, 0x0)
	/usr/local/go/src/runtime/sema.go:510 +0xf8
sync.(*Cond).Wait(0xc0009f80d0)
	/usr/local/go/src/sync/cond.go:56 +0x9d
github.com/cockroachdb/pebble/internal/record.(*flusherCond).Wait(...)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:193
github.com/cockroachdb/pebble/internal/record.(*LogWriter).flushLoop(0xc0009f8000, 0x55f52a0, 0xc000e902a0)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:396 +0x11d
runtime/pprof.Do(0x55f52a0, 0xc000e902a0, 0xc0004f27a0, 0x1, 0x1, 0xc00138dfb8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble/internal/record.NewLogWriter.func2(0xc0009f8000)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:314 +0x89
created by github.com/cockroachdb/pebble/internal/record.NewLogWriter
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:313 +0x2cd
FAIL	github.com/cockroachdb/cockroach/pkg/sql/distsql	1.411s

More

Parameters:

  • GOFLAGS=-json
make stressrace TESTS=TestAggregatorAgainstProcessor PKG=./pkg/sql/distsql TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

See this test on roachdash
powered by pkg/cmd/internal/issues

@cockroach-teamcity cockroach-teamcity added branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot. labels Aug 22, 2020
@cockroach-teamcity cockroach-teamcity added this to the 20.2 milestone Aug 22, 2020
@cockroach-teamcity
Copy link
Member Author

(sql/distsql).TestAggregatorAgainstProcessor failed on master@79ffcf6f736523b704aa671195c732ece55e1c3e:

github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0007ae6c8)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 1157 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x55f5220, 0xc000b30090)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0x76
runtime/pprof.Do(0x55f5220, 0xc000b30090, 0xc0004fc9c0, 0x1, 0x1, 0xc0006037b8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0007ae000)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 1162 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x55f5220, 0xc000b54060)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0x76
runtime/pprof.Do(0x55f5220, 0xc000b54060, 0xc0004fc9c0, 0x1, 0x1, 0xc000e037b8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0007ae4d8)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 1160 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x55f5220, 0xc000b301b0)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0x76
runtime/pprof.Do(0x55f5220, 0xc000b301b0, 0xc0004fc9c0, 0x1, 0x1, 0xc000806fb8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0007ae2e8)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3

goroutine 1159 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x55f5220, 0xc000b30030)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0x76
runtime/pprof.Do(0x55f5220, 0xc000b30030, 0xc0004fc9c0, 0x1, 0x1, 0xc0005ff7b8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0xf8
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc0007ae1f0)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0x89
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x1a3


ERROR: exit status 2

8 runs completed, 1 failures, over 1m2s
context canceled

More

Parameters:

  • TAGS=
  • GOFLAGS=-parallel=4
make stressrace TESTS=TestAggregatorAgainstProcessor PKG=./pkg/sql/distsql TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

See this test on roachdash
powered by pkg/cmd/internal/issues

@cockroach-teamcity
Copy link
Member Author

(sql/distsql).TestAggregatorAgainstProcessor failed on master@79ffcf6f736523b704aa671195c732ece55e1c3e:

runtime/pprof.Do(0x7ffa3e0, 0xc000a0ebd0, 0xc0004ed520, 0x1, 0x1, 0xc000c86fb8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0x109
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc00079f4d8)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0xc1
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x326

goroutine 135 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x7ffa3e0, 0xc000a0a3f0)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0xa9
runtime/pprof.Do(0x7ffa3e0, 0xc000a0a3f0, 0xc0004ed520, 0x1, 0x1, 0xc000af77b8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0x109
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc00079f5d0)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0xc1
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x326

goroutine 136 [chan receive]:
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop.func1(0x7ffa3e0, 0xc000a0ec30)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:159 +0xa9
runtime/pprof.Do(0x7ffa3e0, 0xc000a0ec30, 0xc0004ed520, 0x1, 0x1, 0xc000af7fb8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0x109
github.com/cockroachdb/pebble.(*tableCacheShard).releaseLoop(0xc00079f6c8)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:158 +0xc1
created by github.com/cockroachdb/pebble.(*tableCacheShard).init
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/table_cache.go:150 +0x326

goroutine 137 [sync.Cond.Wait]:
runtime.goparkunlock(...)
	/usr/local/go/src/runtime/proc.go:310
sync.runtime_notifyListWait(0xc000b3a5e0, 0xc000000000)
	/usr/local/go/src/runtime/sema.go:510 +0xf8
sync.(*Cond).Wait(0xc000b3a5d0)
	/usr/local/go/src/sync/cond.go:56 +0x8e
github.com/cockroachdb/pebble/internal/record.(*flusherCond).Wait(...)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:193
github.com/cockroachdb/pebble/internal/record.(*LogWriter).flushLoop(0xc000b3a500, 0x7ffa3e0, 0xc000a0ec90)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:396 +0x144
runtime/pprof.Do(0x7ffa3e0, 0xc000a0ec90, 0xc0004ed000, 0x1, 0x1, 0xc000af87b8)
	/usr/local/go/src/runtime/pprof/runtime.go:37 +0x109
github.com/cockroachdb/pebble/internal/record.NewLogWriter.func2(0xc000b3a500)
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:314 +0xc1
created by github.com/cockroachdb/pebble/internal/record.NewLogWriter
	/go/src/github.com/cockroachdb/cockroach/vendor/github.com/cockroachdb/pebble/internal/record/log_writer.go:313 +0x509


ERROR: exit status 2

10 runs completed, 1 failures, over 3m46s
context canceled

More

Parameters:

  • TAGS=
  • GOFLAGS=-race -parallel=2
make stressrace TESTS=TestAggregatorAgainstProcessor PKG=./pkg/sql/distsql TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

See this test on roachdash
powered by pkg/cmd/internal/issues

@otan
Copy link
Contributor

otan commented Aug 22, 2020

the following query seg faults within GEOS territory:

select st_asewkt(st_union(g::geometry)) from ( values ('010700000003000000010200000004000000524dc13b1bc6eac760e592f6a1439cc786722c8b4ba0e5c720e011036f75b1c73657d16c0470eac71c64e5424c8ddec7fcecc6a3254fc5c7626f2ac8641bddc7010100000070095a4654f3c147807e767db5c0d4c70101000000dae66a3c3403e5c77c0361722b6ce047'), ('0107000000010000000106000000010000000103000000010000000500000008690b3a70a9c347540a11d15993eec7e04b9e4d8fd2cb4702907c2929abe847d02aef5652e3cec72c1b57867da3dd47bbf47698d501eac7ccc0d287b380d44708690b3a70a9c347540a11d15993eec7') ) tbl(g);


goroutine 1847 [syscall]:
_ZN4geos9algorithm6locate24SimplePointInAreaLocator20locatePointInPolygonERKNS_4geom10CoordinateEPKNS3_7PolygonE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135d8df5
_ZN4geos9geomgraph11EdgeEndStar11getLocationEiRKNS_4geom10CoordinateEPNSt3__16vectorIPNS0_13GeometryGraphENS6_9allocatorIS9_EEEE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135ffd18
_ZN4geos9geomgraph11EdgeEndStar16computeLabellingEPNSt3__16vectorIPNS0_13GeometryGraphENS2_9allocatorIS5_EEEE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135ff966
_ZN4geos9geomgraph16DirectedEdgeStar16computeLabellingEPNSt3__16vectorIPNS0_13GeometryGraphENS2_9allocatorIS5_EEEE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135fbdef
_ZN4geos9operation7overlay9OverlayOp16computeLabellingEv
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x13658a4e
_ZN4geos9operation7overlay9OverlayOp14computeOverlayENS2_6OpCodeE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x13657da4
_ZN4geos9operation7overlay9OverlayOp9overlayOpEPKNS_4geom8GeometryES6_NS2_6OpCodeE
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x1365746f
_ZN4geos4geom8BinaryOpINS_9operation7overlay9overlayOpEEENSt3__110unique_ptrINS0_8GeometryENS5_14default_deleteIS7_EEEEPKS7_SC_T_
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135e1111
_ZNK4geos4geom8Geometry5UnionEPKS1_
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos.dylib:0 pc=0x135e1db3
GEOSUnion_r
	/Users/otan/go/src/github.com/cockroachdb/cockroach/lib/libgeos_c.dylib:0 pc=0x11fcbf22
CR_GEOS_Union
	/Users/otan/go/src/github.com/cockroachdb/cockroach/./cockroach:0 pc=0x7639e61
_cgo_30d17c8bd544_Cfunc_CR_GEOS_Union
	/Users/otan/go/src/github.com/cockroachdb/cockroach/./cockroach:0 pc=0x76364e2
runtime.cgocall(0x76364b0, 0xc0015dd378, 0x4000001)

craig bot pushed a commit that referenced this issue Aug 22, 2020
53159: bulkio: Surface errors encountered during schedule planning or execution. r=dt a=miretskiy

Fixes #52916
Fixes #53235

If an error is enountered during schedule planning, appropriate
error messages are logged to the log file(s).  However, the user
might not have access to the logs on the machine.

We now record the last "interesting" schedule event in a new
column `schedule_state` in the `system.scheduled_jobs`, and display
this event with `SHOW SCHEDULES` command.

Whenever schedule completes with an error (either due to planning
or execution), we set the `schedule_state` appropriately.
When schedule completes without errors, we clear out `schedule_state`.

Since we need to alter `system.scheduled_jobs` schema, this PR also
updates the schema to:
  * Add a `NOT NULL` constraint to an `owner` field.
  * Drop `schedule_changes` column since the more complex, protocol
    buffer based column is no longer used.

Release Notes: None

53240: builtins: implement ST_IsClosed, ST_IsSimple, and ST_IsRing r=otan a=erikgrinaker

Release note (sql change): Implement the geometry builtins
`ST_IsClosed`, `ST_IsSimple`, and `ST_IsRing`.

Closes #48953.
Closes #48958.
Closes #48959.

53262: distsql: ignore ST_Union for test as it seg faults r=yuzefovich a=otan

ST_Union seems to segfault in the GEOS world, not much I can do here.
Ignore testing for now.

Refs: #53254

Release note: None

Co-authored-by: Yevgeniy Miretskiy <[email protected]>
Co-authored-by: Erik Grinaker <[email protected]>
Co-authored-by: Oliver Tan <[email protected]>
@yuzefovich yuzefovich assigned otan and unassigned yuzefovich Aug 22, 2020
@otan otan changed the title sql/distsql: TestAggregatorAgainstProcessor failed GEOS: panic for MULTIPOLYGON within a GEOMETRYCOLLECTION Aug 22, 2020
@otan otan changed the title GEOS: panic for MULTIPOLYGON within a GEOMETRYCOLLECTION GEOS: panic for single MULTIPOLYGON within a GEOMETRYCOLLECTION Aug 25, 2020
@otan otan assigned sumeerbhola and unassigned otan Aug 27, 2020
@sumeerbhola
Copy link
Collaborator

The bt output from a debug build:

  * frame #0: 0x0000000100179620 libgeos.3.8.1.dylib`geos::algorithm::locate::SimplePointInAreaLocator::locatePointInPolygon(p=0x00000001013049a0, poly=0x0000000000000000) at SimplePointInAreaLocator.cpp:88:8
    frame #1: 0x0000000100179547 libgeos.3.8.1.dylib`geos::algorithm::locate::SimplePointInAreaLocator::locateInGeometry(p=0x00000001013049a0, geom=0x00000001012046c0) at SimplePointInAreaLocator.cpp:70:16
    frame #2: 0x0000000100179465 libgeos.3.8.1.dylib`geos::algorithm::locate::SimplePointInAreaLocator::locate(p=0x00000001013049a0, geom=0x00000001012046c0) at SimplePointInAreaLocator.cpp:53:12
    frame #3: 0x00000001002163b7 libgeos.3.8.1.dylib`geos::geomgraph::EdgeEndStar::getLocation(this=0x0000000101005740, geomIndex=1, p=0x00000001013049a0, geom=0x00007ffeefbfe090 size=2) at EdgeEndStar.cpp:200:39
    frame #4: 0x0000000100216183 libgeos.3.8.1.dylib`geos::geomgraph::EdgeEndStar::computeLabelling(this=0x0000000101005740, geomGraph=0x00007ffeefbfe090 size=2) at EdgeEndStar.cpp:172:27
    frame #5: 0x00000001003bd02e libgeos.3.8.1.dylib`geos::operation::relate::RelateComputer::labelNodeEdges(this=0x00007ffeefbfe0a8) at RelateComputer.cpp:415:27
    frame #6: 0x00000001003bc27b libgeos.3.8.1.dylib`geos::operation::relate::RelateComputer::computeIM(this=0x00007ffeefbfe0a8) at RelateComputer.cpp:206:5
    frame #7: 0x00000001003c3e03 libgeos.3.8.1.dylib`geos::operation::relate::RelateOp::getIntersectionMatrix(this=0x00007ffeefbfe008) at RelateOp.cpp:70:23
    frame #8: 0x00000001003c3d65 libgeos.3.8.1.dylib`geos::operation::relate::RelateOp::relate(a=0x0000000101204380, b=0x00000001012046c0) at RelateOp.cpp:42:18
    frame #9: 0x0000000100195984 libgeos.3.8.1.dylib`geos::geom::Geometry::relate(this=0x0000000101204380, other=0x00000001012046c0) const at Geometry.cpp:475:12
    frame #10: 0x0000000100195ca2 libgeos.3.8.1.dylib`geos::geom::Geometry::intersects(this=0x0000000101204380, g=0x00000001012046c0) const at Geometry.cpp:332:39

The poly parameter to SimplePointInAreaLocator::locatePointInPolygon(const Coordinate& p, const Polygon* poly) is NULL
This is because the caller has the following code:

    if (geom->getDimension() < 2) {
        return Location::EXTERIOR;
    }

    if (geom->getNumGeometries() == 1) {
        return locatePointInPolygon(p, dynamic_cast<const Polygon*>(geom->getGeometryN(0)));
    } else {
...

It gets a dimension of 2 and assumes it is a Polygon when it is actually a MultiPolygon. The dynamic_cast takes a non-NULL MultiPolygon and turn it into NULL.

@sumeerbhola
Copy link
Collaborator

sumeerbhola commented Sep 2, 2020

The following seems to fix this

diff --git a/src/algorithm/locate/SimplePointInAreaLocator.cpp b/src/algorithm/locate/SimplePointInAreaLocator.cpp
index 93e94828..92c9dbe2 100644
--- a/src/algorithm/locate/SimplePointInAreaLocator.cpp
+++ b/src/algorithm/locate/SimplePointInAreaLocator.cpp
@@ -67,15 +67,18 @@ SimplePointInAreaLocator::locateInGeometry(const Coordinate& p, const Geometry*
     }
 
     if (geom->getNumGeometries() == 1) {
-        return locatePointInPolygon(p, dynamic_cast<const Polygon*>(geom->getGeometryN(0)));
-    } else {
-        for (size_t i = 0; i < geom->getNumGeometries(); i++) {
-            const Geometry* gi = geom->getGeometryN(i);
+        auto poly = dynamic_cast<const Polygon*>(geom->getGeometryN(0));
+        if (poly) {  
+            return locatePointInPolygon(p, dynamic_cast<const Polygon*>(geom->getGeometryN(0)));
+        }
+        // Else it is a collection with a single element. Will be handled below.
+    }
+    for (size_t i = 0; i < geom->getNumGeometries(); i++) {
+        const Geometry* gi = geom->getGeometryN(i);
 
-            auto loc = locateInGeometry(p, gi);
-            if(loc != Location::EXTERIOR) {
-                return loc;
-            }
+        auto loc = locateInGeometry(p, gi);
+        if(loc != Location::EXTERIOR) {
+            return loc;
         }
     }
root@:26257/defaultdb> select st_asewkt(st_union(g::geometry)) from ( values ('010700000003000000010200000004000000524dc13b1bc6eac760e592f6a1439cc786722c8b4ba0e5c720e011036f75b1c73657d16c0470eac71c64e5424c8ddec7fcecc6a3254fc5c7626f2ac8641bddc7010100000070095a4654f3c147807e767db5c0d4c70101000000dae66a3c3403e5c77c0361722b6ce047'), ('0107000000010000000106000000010000000103000000010000000500000008690b3a70a9c347540a11d15993eec7e04b9e4d8fd2cb4702907c2929abe847d02aef5652e3cec72c1b57867da3dd47bbf47698d501eac7ccc0d287b380d44708690b3a70a9c347540a11d15993eec7') ) tbl(g);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        st_asewkt
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  GEOMETRYCOLLECTION (POINT (-223443394193059776096440385617956700160 174634377591425258415024906829530398720), LINESTRING (-284708440221941415362615251652759781376 -9392388193758938278543482515485622272, -229968700928315679058028036058268041216 -23206626251474833216396853952911507456, -281132439117051825151057776883468861440 -162442001975130329633786067845361172480, -76265361193449771192120627645902749696 -155430717431627098037196662139040825344), POLYGON ((-76265361193449771192120627645902749696 -155430717431627098037196662139040825344, -276555619360061757108352906389039874048 109011260903746790607321940254127030272, -82114322611326064412904307862586523648 157586008841744060894387875289021546496, 73964889521234473911909189727339675648 262321516218768682064796546831604514816, 52270212635292264733678490638272692224 -325135433681332139458928453080976457728, -76265361193449771192120627645902749696 -155430717431627098037196662139040825344)))
(1 row)

@otan are we directly making fixes in https://github.com/cockroachdb/geos/

@otan
Copy link
Contributor

otan commented Sep 2, 2020

ooh nice!

yeah you can put an extra commit on top of 385ac9b562c2847dc059109e0435a80e68a0c8b6.

you can submit a PR against the GEOS library too.

@sumeerbhola
Copy link
Collaborator

The fix for us is at https://github.com/cockroachdb/geos/tree/mpcast
@otan Does this need a PR? If not, can you pick it up -- I am not clear on how to do that?

And opened a PR for GEOS libgeos/geos#334

@otan
Copy link
Contributor

otan commented Sep 2, 2020

I will set up the PR.

otan added a commit to otan-cockroach/cockroach that referenced this issue Sep 3, 2020
Resolves cockroachdb#53254.

Release justification: bug fix to new functionality

Release note: None
craig bot pushed a commit that referenced this issue Sep 3, 2020
53800: server: defer gossip start to when absolutely needed r=irfansharif a=irfansharif

This was pulled out of #52526 to keep the diff there focussed on the
introduction of the RPC (and to see if that alone shaked out any
failures). That change lets us make this one, were we can defer gossip
start until right before we start up Node.

Release justification: low risk, high benefit change to existing functionality
Release note: None

53846: sql: fix inflated "overhead" in statement timings r=solongordon a=solongordon

Fixes #40675
Fixes #50108

Release justification: Low-risk, high-reward fix to existing
functionality.

Release note (admin ui change): In some cases, the Execution Stats page
would show a confusingly high Overhead latency for a statement. This
could happen due to multiple statements being parsed together or due to
statement execution being retried. To avoid this, we stop considering
the time between when parsing ends and execution begins when determining
service latency.

53906: roachtest: Unskip disk-full roachtest r=tbg a=itsbilal

The disk-full roachtest no longer fails now that Pebble is the
default storage engine. Remove the skipped marker.

Fixes #35328.

Release justification: Roachtest-only change.
Release note: None.

53907: geos: bump to include seg fault fix r=sumeerbhola a=otan

Resolves #53254.

Release justification: bug fix to new functionality

Release note: None

Co-authored-by: irfan sharif <[email protected]>
Co-authored-by: Solon Gordon <[email protected]>
Co-authored-by: Bilal Akhtar <[email protected]>
Co-authored-by: Oliver Tan <[email protected]>
@craig craig bot closed this as completed in f037af1 Sep 3, 2020
strk pushed a commit to libgeos/geos that referenced this issue Nov 6, 2020
strk added a commit to libgeos/geos that referenced this issue Nov 6, 2020
Backport of patch by Oliver Tan

Closes #1047 in 3.8 branch (3.8.2dev)
References cockroachdb/cockroach#53254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants