Opened 21 years ago
Closed 21 years ago
#413 closed defect (fixed)
msGetErrorString causes segfaults on Linux inside Python MapScript exceptions
Reported by: | Owned by: | sdlime | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | MapServer C Library | Version: | 4.0 |
Severity: | normal | Keywords: | |
Cc: | mschulz@… |
Description
A Python MapScript user on Linux (Michael Schultz) has reported consistent segmentation faults when MapScript raises exceptions. The problem appears to be with msGetErrorString, or the way it is used in the SWIG exception wrapper. I have rolled back the code in CVS branch-4-0 to the previous state before msGetErrorString was introduced and this is once again working for Michael. In this older code, there is just one single call to msGetErrorObj per exception. In the new (buggy?) code, there is at least two calls to msGetErrorObj with one in msGetErrorString. I never experienced any problems with using msGetErrorString and I'm beginning to wonder if it is a threading problem. Michael has not yet confirmed whether he was using a MapServer configured --with-threads.
Change History (2)
comment:2 by , 21 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Steve, Sorry to alarm you. I entered this bug so that I'd be motivated to find the solution, not to make you look into msGetErrorString. The function appears to be OK, it was just a matter of how I'd been calling it. I'm not sure why it wasn't segfaulting on my Mac. The issue that Michael had reported to me on Linux is fixed by using msGetErrorString in this way: switch (errcode) { case MS_IOERR: PyErr_SetString(PyExc_IOError, msGetErrorString("\n")); break; case MS_MEMERR: PyErr_SetString(PyExc_MemoryError, msGetErrorString("\n")); break; case MS_TYPEERR: PyErr_SetString(PyExc_TypeError, msGetErrorString("\n")); break; case MS_EOFERR: PyErr_SetString(PyExc_EOFError, msGetErrorString("\n")); break; case MS_NOTFOUND: PyErr_SetString(MSExc_MapServerNotFoundError, msGetErrorString("\n")); break; I've verified that it works on a client's RH Linux machine this afternoon.
Note:
See TracTickets
for help on using tickets.