[Commits] a4f7d85: MDEV-18920 Prepared statements with st_convexhull hang and eat 100% cpu.

Alexey Botchkov holyfoot at askmonty.org
Mon Apr 22 22:29:54 EEST 2019


revision-id: a4f7d859322ab771289abf13f50752266af43187 (mariadb-10.1.38-114-ga4f7d85)
parent(s): 6c5e4c9bc0d9ac30f7ec7ee334630bacb58687ba
committer: Alexey Botchkov
timestamp: 2019-04-22 23:28:44 +0400
message:

MDEV-18920 Prepared statements with st_convexhull hang and eat 100% cpu.

In the case of error when object shapes are half-collected we need
to set the NULL at the vertice's list.

---
 mysql-test/r/gis-precise.result | 4 ++++
 mysql-test/t/gis-precise.test   | 6 ++++++
 sql/gcalc_slicescan.cc          | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result
index 89e5c23..76f72bb 100644
--- a/mysql-test/r/gis-precise.result
+++ b/mysql-test/r/gis-precise.result
@@ -505,6 +505,10 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'),
     ) as relate_res;
 relate_res
 0
+prepare s from 'do st_convexhull(st_aswkb(multipoint(point(-11702,15179),point(-5031,27960),point(-30557,11158),point(-27804,30314))))';
+execute s;
+execute s;
+deallocate prepare s;
 DROP TABLE IF EXISTS p1;
 CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
 BEGIN
diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test
index 7391b21..7626da6 100644
--- a/mysql-test/t/gis-precise.test
+++ b/mysql-test/t/gis-precise.test
@@ -381,5 +381,11 @@ SELECT ST_RELATE(
     'F*FFFF**F'
     ) as relate_res;
 
+# MDEV-18920 Prepared statements with st_convexhull hang and eat 100% cpu.
+prepare s from 'do st_convexhull(st_aswkb(multipoint(point(-11702,15179),point(-5031,27960),point(-30557,11158),point(-27804,30314))))';
+execute s;
+execute s;
+deallocate prepare s;
+
 --source include/gis_debug.inc
 
diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc
index ab48542..644ab4b 100644
--- a/sql/gcalc_slicescan.cc
+++ b/sql/gcalc_slicescan.cc
@@ -982,6 +982,8 @@ void Gcalc_heap::reset()
 {
   if (m_n_points)
   {
+    if (m_hook)
+      *m_hook= NULL;
     free_list(m_first);
     m_n_points= 0;
   }


More information about the commits mailing list