Description:
server1: mysql-standard-4.1.4 custom compiled from source
server2: mysql-standard-4.1.5-gamma-unknown-linux-x86_64-glibc23.tar.gz
Sometimes, when selecting ASTEXT(centroid(geo)) of a multipolygon geometry, the server crashes the thread or completely crashes the mysql server.
The inclusion of ASTEXT(geo) in results of the same select statement stops the crash from occuring.
I ran into this when I was investigating why some multipolygons return NULL for centroid on valid multipolygons when other work.
How to repeat:
CREATE TABLE `geo` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` geometry NOT NULL default '') ENGINE=MyISAM ;
insert into geo values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363 36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163 36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363 36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364 36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882 36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207 36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017 36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072 36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755 36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725 36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556 36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105 36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344 36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356 36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499 36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308 36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527 36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113 36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354 36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768 36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662 36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659 36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764 36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517 36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403 36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183 36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729 36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934 36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731 36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759 36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835 36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758 36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843 36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051 36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913 36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918 36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314 36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858 36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335 36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734 36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491 36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133 36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233 36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533 36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331 36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535 36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135 36.240569,-115.083135 36.240569,-115.079835 36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107 36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226 36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733 36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107 36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438 36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545 36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757 36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489 36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519 36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553 36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347 36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069 36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039 36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439 36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(geo), ASTEXT(centroid(geo)) from geo;
No crash...
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from geo where object_id=85998;
OK, but unexpected results (NULL for centroid) (notice the missing ASTEXT(geo) from select and specific id)
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from geo where object_id=85984;
(notice the missing ASTEXT(geo) from select and specific id)
CRASH