[mapserver-dev] Mapserver assertion handling causing potential crashes

Tamas Szekeres szekerest at gmail.com
Fri Feb 11 11:08:43 PST 2022


Hi Devs,

We are experiencing frequent crashes in the mapserver codebase in a heavy
loaded runtime environment that causes the entire host process to exit
regularly. According to the crash report it mostly points to the following
location:























*static int msOGRGetPaging(layerObj *layer){#ifdef USE_OGR  msOGRFileInfo
*layerinfo = NULL;  if (layer->debug) {    msDebug("msOGRGetPaging
called.\n");  }  if(!msOGRLayerIsOpen(layer))    msOGRLayerOpenVT(layer);
assert( layer->layerinfo != NULL);   <<<<< assert is happenting here
layerinfo = (msOGRFileInfo *)layer->layerinfo;  return layerinfo->bPaging;
 <<<<< crash is happening here#else  msSetError( MS_MISCERR,
"OGR support is not available.",              "msOGREnablePaging()");
return MS_FAILURE;#endif}*

I just wanted to ask, what do folks think about this practice? It looks
like the author of the code thinks that something will happen in the
assertion to prevent the code to execute the next statements. However the
assert check does no op in a production build or in a process that is not
attached to a debugger session. As far as I can imagine the code should
programmatically handle the asserted situation and do something useful if
in our case layer->layerinfo is NULL.
As far as I see, the current codebase is full of such preconception that
assert stops the operation (or exits the function, whatever?) and we should
do nothing special when the condition is met.

Any thoughts?

Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20220211/51905871/attachment.html>


More information about the MapServer-dev mailing list