[mapserver-dev] Mapserver assertion handling causing potential crashes
Steve Lime
sdlime at gmail.com
Sat Feb 12 10:49:14 PST 2022
Assuming you’re interpreting this correctly then I agree with you. I’ve not
used assertions personally.
On Fri, Feb 11, 2022 at 1:09 PM Tamas Szekeres <szekerest at gmail.com> wrote:
> 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
>
>
>
>
> _______________________________________________
> MapServer-dev mailing list
> MapServer-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20220212/4c9b3f60/attachment.html>
More information about the MapServer-dev
mailing list