Opened 18 years ago

Closed 18 years ago

#1526 closed defect (fixed)

Mapserv CGI process grabs 100% CPU

Reported by: m.cave-ayland@… Owned by: warmerdam
Priority: high Milestone: 4.8 release
Component: MapServer CGI Version: 4.8
Severity: critical Keywords:
Cc:

Description

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.

Attachments (1)

mapproject.patch (1.4 KB ) - added by m.cave-ayland@… 18 years ago.
Patch against mapserver 3.6.6

Download all attachments as: .zip

Change History (4)

by m.cave-ayland@…, 18 years ago

Attachment: mapproject.patch added

Patch against mapserver 3.6.6

comment:1 by m.cave-ayland@…, 18 years ago

Owner: changed from sdlime to fwarmerdam
Assigned to Frank as per IRC request.

comment:2 by fwarmerdam, 18 years ago

Milestone: 4.8 release
Status: newassigned
Version: unspecified4.8

comment:3 by fwarmerdam, 18 years ago

Resolution: fixed
Status: assignedclosed
I have applied a similar patch in MapServer 4.8 (should appear in beta 2). 
I have also setup msautotest/misc/bug1526.map to test the fix.  Without the
fix this map would hand when rendering, and with the fix it works fine. 

Thanks!   This bug has been in the software for a long time. 

Note: See TracTickets for help on using tickets.