Mapserv CGI process grabs 100% CPU
Hi there,
I have recently come across a serious problem where I have a number of mapserv
CGI processes running on the server consuming 100% CPU, effectively causing a
DOS on our webserver.
Although we are still running mapserver 3.6 which is not officially supported,
talking with FrankW on IRC yesterday it appears as if the same issue is also
present in later versions of mapserver, so I am filing the bug here as requested.
The problem is caused by rounding errors in mapproject.c. Normally when users
zoom too far into the map, the minimum and maximum extents in either the X or Y
direction become zero and msCalculateScale() will throw an error. What was
happening in this case was that users were zooming so far into the map that
minimum and maximum x/y extents were similar to about 8 decimal places, but in
mapproject.c, msProjectRect() further divides this interval by 100 to produce an
offset within a for() loop and repeatedly adds this offset during each loop
iteration. Unfortunately in this case dividing the interval by 100 effectively
produced a zero offset and so the process could never exit the loop.
The solution, as suggested by Frank, is to re-condition the equations so that
the loop offset is calculated as a direct multiple of the interval, which limits
the number of iterations to NUMBER_OF_SAMPLE_POINTS.
Please find enclosed a patch which when applied to mapserver 3.6.6 solves the
problem on our live server - it should be fairly trivial to apply this to later
versions. Many thanks to Frank and others on the IRC channel for their suggestions.
Mark.
Change History
(4)
Owner: |
changed from sdlime to fwarmerdam
|
Milestone: |
→ 4.8 release
|
Status: |
new → assigned
|
Version: |
unspecified → 4.8
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Patch against mapserver 3.6.6