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

[CI] org.elasticsearch.search.geo.GeoShapeQueryTests. testQueryRandomGeoCollection failure #37356

Closed
iverase opened this issue Jan 11, 2019 · 10 comments
Assignees
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v7.2.0 v8.0.0-alpha1

Comments

@iverase
Copy link
Contributor

iverase commented Jan 11, 2019

I noticed some failures in the test above. For example:

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.6+multijob-unix-compatibility/os=fedora/46/console

It can be reproduced without adding the method name:

./gradlew :server:unitTest
-Dtests.seed=506AA3004455CABB
-Dtests.class=org.elasticsearch.search.geo.GeoShapeQueryTests
-Dtests.method="testQueryRandomGeoCollection"
-Dtests.security.manager=true
-Dtests.locale=it
-Dtests.timezone=Asia/Vladivostok
-Dcompiler.java=11
-Druntime.java=8

I had a look into it and I could reproduce the issue at Lucene level.

The problem is that we are generating degenerated polygons in one dimension, for example:

polygon ((1.401298464324817E-45 22.0, 1.401298464324817E-45 69.0, 4.8202184588118395E-40 69.0, 4.8202184588118395E-40 22.0, 1.401298464324817E-45 22.0))

Then when indexing this polygon and perform an intersect query using the same one, they do not match. This is probably due to the encoding Lucene is using.

@iverase iverase changed the title [CI] org.elasticsearch.search.geo.GeoShapeQueryTests. testQueryRandomGeoCollection fails occas [CI] org.elasticsearch.search.geo.GeoShapeQueryTests. testQueryRandomGeoCollection failure Jan 11, 2019
@iverase iverase added >bug :Analytics/Geo Indexing, search aggregations of geo points and shapes v7.0.0 labels Jan 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo

@iverase iverase added the v6.7.0 label Jan 11, 2019
@iverase
Copy link
Contributor Author

iverase commented Jan 11, 2019

I have opened https://issues.apache.org/jira/browse/LUCENE-8634

@jkakavas
Copy link
Member

@imotov
Copy link
Contributor

imotov commented Jan 17, 2019

@jkakavas did you mute it only in 6.x? I think it should be failing in all branches, I opened #37579 that should ignore the failing part of the test if a tiny polygon is generated,

@imotov
Copy link
Contributor

imotov commented Jan 23, 2019

I unmuted the test and added assumeTrue to ignore tests with random polygons that are causing issues because of LUCENE-8634. The changes are merged into 6.6, 6.x and 7.x.

@nknize
Copy link
Contributor

nknize commented Jan 25, 2019

I've added some feedback on this issue at https://issues.apache.org/jira/browse/LUCENE-8634

tldr; subcentimeter polygons are not supported w/ the encoding we use in the WGS84 projection. Polygons this small should be reserved for an alternate projection (e.g., mercator, UTM). This will eventually be supported with a new XYShape / geometry field type (probably ES 8.0).

@talevy
Copy link
Contributor

talevy commented Feb 20, 2019

related issue popped up today

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.6+release-tests/209/console

./gradlew :server:unitTest \
  -Dtests.seed=4E97A47EAD7E2AC3 \
  -Dtests.class=org.elasticsearch.search.geo.GeoShapeQueryTests \
  -Dtests.method="testRandomGeoCollectionQuery" \
  -Dtests.security.manager=true \
  -Dbuild.snapshot=false \
  -Dtests.jvm.argline="-Dbuild.snapshot=false" \
  -Dtests.locale=es-HN \
  -Dtests.timezone=SystemV/HST10 \
  -Dcompiler.java=11 \
  -Druntime.java=8
ERROR   0.08s J6 | GeoShapeQueryTests.testRandomGeoCollectionQuery <<< FAILURES!
   > Throwable #1: MapperParsingException[failed to parse field [location] of type [geo_shape]]; nested: InvalidShapeException[Cannot determine orientation: edges adjacent to (-6.7745978568024175E-133,-2.8287277918521384E-246) coincide];
   > 	at __randomizedtesting.SeedInfo.seed([4E97A47EAD7E2AC3:26EAAADDFB5DF54B]:0)
   > 	at org.elasticsearch.index.mapper.GeoShapeFieldMapper.parse(GeoShapeFieldMapper.java:116)
   > 	at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrField(DocumentParser.java:488)
   > 	at org.elasticsearch.index.mapper.DocumentParser.parseObject(DocumentParser.java:505)
   > 	at org.elasticsearch.index.mapper.DocumentParser.innerParseObject(DocumentParser.java:395)
   > 	at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrNested(DocumentParser.java:384)
   > 	at org.elasticsearch.index.mapper.DocumentParser.internalParseDocument(DocumentParser.java:96)
   > 	at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:69)
   > 	at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:281)
   > 	at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:763)
   > 	at org.elasticsearch.index.shard.IndexShard.applyIndexOperation(IndexShard.java:739)
   > 	at org.elasticsearch.index.shard.IndexShard.applyIndexOperationOnPrimary(IndexShard.java:718)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.lambda$executeIndexRequestOnPrimary$3(TransportShardBulkAction.java:463)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.executeOnPrimaryWhileHandlingMappingUpdates(TransportShardBulkAction.java:486)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.executeIndexRequestOnPrimary(TransportShardBulkAction.java:461)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.executeBulkItemRequest(TransportShardBulkAction.java:216)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.performOnPrimary(TransportShardBulkAction.java:159)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.performOnPrimary(TransportShardBulkAction.java:151)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:139)
   > 	at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:79)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryShardReference.perform(TransportReplicationAction.java:1051)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryShardReference.perform(TransportReplicationAction.java:1029)
   > 	at org.elasticsearch.action.support.replication.ReplicationOperation.execute(ReplicationOperation.java:102)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.runWithPrimaryShardReference(TransportReplicationAction.java:425)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.lambda$doRun$0(TransportReplicationAction.java:371)
   > 	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:60)
   > 	at org.elasticsearch.index.shard.IndexShardOperationPermits.acquire(IndexShardOperationPermits.java:273)
   > 	at org.elasticsearch.index.shard.IndexShardOperationPermits.acquire(IndexShardOperationPermits.java:240)
   > 	at org.elasticsearch.index.shard.IndexShard.acquirePrimaryOperationPermit(IndexShard.java:2352)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction.acquirePrimaryOperationPermit(TransportReplicationAction.java:988)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.doRun(TransportReplicationAction.java:370)
   > 	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:325)
   > 	at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:312)
   > 	at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:66)
   > 	at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:687)
   > 	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:759)
   > 	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
   > 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   > 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   > 	at java.lang.Thread.run(Thread.java:748)
   > Caused by: org.locationtech.spatial4j.exception.InvalidShapeException: Cannot determine orientation: edges adjacent to (-6.7745978568024175E-133,-2.8287277918521384E-246) coincide
   > 	at org.elasticsearch.common.geo.builders.PolygonBuilder.getOrientation(PolygonBuilder.java:763)
   > 	at org.elasticsearch.common.geo.builders.PolygonBuilder.ring(PolygonBuilder.java:716)
   > 	at org.elasticsearch.common.geo.builders.PolygonBuilder.createEdges(PolygonBuilder.java:698)
   > 	at org.elasticsearch.common.geo.builders.PolygonBuilder.coordinates(PolygonBuilder.java:215)
   > 	at org.elasticsearch.common.geo.builders.PolygonBuilder.buildLucene(PolygonBuilder.java:238)
   > 	at org.elasticsearch.common.geo.builders.GeometryCollectionBuilder.buildLucene(GeometryCollectionBuilder.java:193)
   > 	at org.elasticsearch.index.mapper.GeoShapeFieldMapper.parse(GeoShapeFieldMapper.java:110)
   > 	... 39 more

@imotov
Copy link
Contributor

imotov commented Feb 21, 2019

That looks like a different issue. The original issue was caused by lucene indexing and this issue is caused by parsing. I will take a look.

@imotov imotov self-assigned this Feb 21, 2019
imotov added a commit to imotov/elasticsearch that referenced this issue Feb 21, 2019
Moves the check for tiny polygons earlier in the test. It turned out
that polygons can be so tiny that we cannot even figure out their
orientation.

Relates to elastic#37356
@imotov
Copy link
Contributor

imotov commented Feb 21, 2019

So. It turned out it is a different issue, but with the same cause. GeoTestUtil.nextPolygon() can generate such a small polygon that it causes arithmetic underflow when we try to calculate orientation. In this case the polygon that is causing the issue is this:

{
  "type" : "polygon",
  "orientation" : "right",
  "coordinates" : [
    [
      [
        -6.7745978568024175E-133,
        -2.8287277918521384E-246
      ],
      [
        -6.7745978568024175E-133,
        0.0
      ],
      [
        -3.3164115140693285E-230,
        0.0
      ],
      [
        -6.7745978568024175E-133,
        -2.8287277918521384E-246
      ]
    ]
  ]
}

I opened #39275 to ignore the test if such a small polygon is generated for now.

However, I am wondering if we should change GeoTestUtil.nextPolygon() to generate more practical polygons. While precision is important, in this particular case we are talking about a polygon smaller than 10-127m if my math is correct. I cannot really think for any practical applications for that besides implementing geo search for small objects in the Arquillian Galaxy.

imotov added a commit that referenced this issue Feb 25, 2019
Moves the check for tiny polygons earlier in the test. It turned out
that polygons can be so tiny that we cannot even figure out their
orientation.

Relates to #37356
imotov added a commit that referenced this issue Feb 25, 2019
Moves the check for tiny polygons earlier in the test. It turned out
that polygons can be so tiny that we cannot even figure out their
orientation.

Relates to #37356
imotov added a commit that referenced this issue Feb 25, 2019
Moves the check for tiny polygons earlier in the test. It turned out
that polygons can be so tiny that we cannot even figure out their
orientation.

Relates to #37356
imotov added a commit that referenced this issue Feb 25, 2019
Moves the check for tiny polygons earlier in the test. It turned out
that polygons can be so tiny that we cannot even figure out their
orientation.

Relates to #37356
imotov added a commit that referenced this issue Feb 25, 2019
Moves the check for tiny polygons earlier in the test. It turned out
that polygons can be so tiny that we cannot even figure out their
orientation.

Relates to #37356
@imotov
Copy link
Contributor

imotov commented Apr 6, 2019

I cannot find any failures since the last fix was merged. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

No branches or pull requests

9 participants