Ticket #1432 (closed defect: fixed)

Opened 17 months ago

Last modified 17 months ago

[RASTER] segfaults on regression testing with --enable-cassert

Reported by: strk Owned by: dustymugs
Priority: critical Milestone: PostGIS 2.0.0
Component: raster Version: trunk
Keywords: Cc:

Change History

Changed 17 months ago by strk

One failure is in rt_asgdalraster and particularly this call:

SELECT ST_AsGDALRaster(
 ST_AddBand(
  ST_AddBand(
   ST_AddBand(
    ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0),
    1, '8BSI', 1, -1
   ), 
   2, '8BSI', 11, -1
  ),
  3, '8BSI', 111, -1
 ),
 'PNG',
 ARRAY['ZLEVEL=1']
);

Dropping the ARRAY parameter fixes the segfault

Changed 17 months ago by strk

  • owner changed from pracine to dustymugs

What happens is that RASTER_asGDALRaster builds the "options" variable to be NULL terminated but trims the allocated array to the exact number of items thus de-allocating he terminating null.

r8674 fixes this case, but there are more. --enable-cassert is your friend Bborie !

Changed 17 months ago by strk

Next is RT_BandMetadata, segfaulting on this:

SELECT 
        pixeltype,
        hasnodata,
        round(nodatavalue::numeric, 3),
        isoutdb,
        path
FROM ST_BandMetaData(
        make_test_raster(10, 10, 0, 0, 0, 0, 5, TRUE),
        6
);

Changing last arg to 5 prevents the crash

Changed 17 months ago by strk

  • status changed from new to closed
  • resolution set to fixed

This one is fixed by properly switching memory context back before exiting prematurely from the function. I've seen other such cases but the testsuite doesn't react with a segfault. See r8678

Changed 17 months ago by dustymugs

  • status changed from closed to reopened
  • resolution fixed deleted

I'm reopening this as I'll be auditing all the other raster functions.

Changed 17 months ago by dustymugs

  • status changed from reopened to new

Fixes for ST_Histogram, ST_Quantile, ST_Reclass, ST_SummaryStats and ST_ValueCount added in r8679.

Changed 17 months ago by robe

Bborie,

I wonder if this will fix the crashing issue I was experiencing with my garden tests that you couldn't repelicate. That is almost always crashed on ST_reclass. I forgot that I don't test PostgreSQL on windows the normal way.

I use the zipped EDB builds and do not launch the instances as a service. So the EDB zipped builds may be a little different from the installer ones or the fact I launch them from a batch script rather than a service may also make a difference.

Changed 17 months ago by robe

I'll give those tests a retry and close out that other ticket if this fixes it.

Changed 17 months ago by dustymugs

Regina,

That's the hope. It is absolutely plausible that the memory handling was causing crashes in your garden tests. I'm going to be auditing all the raster functions... hopefully have it done today and before you tag an alpha.

Changed 17 months ago by dustymugs

  • status changed from new to assigned

Added additional regression tests for ST_AsGDALRaster, ST_GDALDrivers, ST_AsRaster, ST_Resample, ST_Metadata in r8681.

Changed 17 months ago by dustymugs

  • status changed from assigned to closed
  • resolution set to fixed

Last bit of code cleanup from auditing rt_pg.c in r8683.

Note: See TracTickets for help on using tickets.