Ticket #107 (new defect)

Opened 5 months ago

Last modified 4 months ago

Crashing with TextSymbolizer and line placement.

Reported by: Brian Owned by: artem
Priority: critical (top) Milestone:
Component: Core Library Version:
Severity: Major Keywords:
Cc: Patch Needs Improvement:
Needs Docmentation: Has Patch?:
Design Decision Needed:

Description

I can regularly crash mapnik if I try to label a point geometric with a TextSymbolizer using line placement (which is very easy to do with an ElseFilter). It actually dies with a boost exception.

However, I can't get the actually boost exception message, I just get:

std::bad_alloc "St9bad_alloc"

which google tells me many people get without a easy solution to get the correct error message, so I am not quite sure where the problem actually is.

I suppose a simple change would be to src/agg_renderer.cpp at line 707 to:

if (sym.get_label_placement() == POINT_PLACEMENT | | geom.num_points() == 1)

(not the extra space between the | | which TRAC appears to require) which seems to have fixed the problem in my testing.

Change History

Changed 5 months ago by Brian

Looks like it is line 693, not line 707. Sorry.

Changed 5 months ago by lwu

Brian, do you have a small bit of sample code which causes the crash?

Changed 5 months ago by Brian

I have rules that looks something like this:

<Rule>

<Filter>[highway] = 'motorway'</Filter> <ShieldSymbolizer name="name" face_name="DejaVu? Sans Bold" size="11" fill="#809bc0" placement="line" file="$MSLHOME/syms/interstate.png" type="png" width="22" height="22" min_distance="100"/>

</Rule> <Rule>

<Filter>[highway] = 'primary'</Filter> <TextSymbolizer name="name" face_name="DejaVu? Sans Book" size="8" fill="black" halo_radius="0" placement="line"/>

</Rule> <Rule>

<Filter>[highway] = 'secondary'</Filter> <TextSymbolizer name="name" face_name="DejaVu? Sans Book" size="10" fill="black" halo_radius="1" halo_fill="#fdbf6f" placement="line"/>

</Rule> <Rule>

<ElseFilter/> <TextSymbolizer name="name" face_name="DejaVu? Sans Book" size="8" fill="black" halo_radius="1" placement="line"/>

</Rule>

If I try to render a point symbol symbol using these rules, it crashes with the exception in the first post. If I change my rules to filter out the point features like this:

<Rule>

<Filter>[mapnik:geometry] = '1'</Filter> <TextSymbolizer name="name" face_name="DejaVu? Sans Book" size="8" fill="#636" dy="10" halo_radius="1" wrap_width="0"/>

</Rule> <Rule>

<Filter>not [mapnik:geometry] = '1' and [highway] = 'motorway'</Filter> <ShieldSymbolizer name="name" face_name="DejaVu? Sans Bold" size="11" fill="#809bc0" placement="line" file="$MSLHOME/syms/interstate.png" type="png" width="22" heigh

t="22" min_distance="100"/>

</Rule> <Rule>

<Filter>not [mapnik:geometry] = '1' and [highway] = 'primary'</Filter> <TextSymbolizer name="name" face_name="DejaVu? Sans Book" size="8" fill="black" halo_radius="0" placement="line"/>

</Rule> <Rule>

<Filter>not [mapnik:geometry] = '1' and [highway] = 'secondary'</Filter> <TextSymbolizer name="name" face_name="DejaVu? Sans Book" size="10" fill="black" halo_radius="1" halo_fill="#fdbf6f" placement="line"/>

</Rule> <Rule>

<ElseFilter/> <TextSymbolizer name="name" face_name="DejaVu? Sans Book" size="8" fill="black" halo_radius="1" placement="line"/>

</Rule>

(Note, I added the mapnik:geometry lines in the other rules to make sure I don't pass multiple rules).

This will now render without the exception. Digging into the mapnik source is where I picked the change I did (which made sense to me. Why try line placement when there is only one point in the geometric).

This is under Fedora 8, gcc 4.1.2, boost 1.34.1, and mapnik 0.5.1.

- Brian

Changed 4 months ago by springmeyer

  • priority set to critical (top)
Note: See TracTickets for help on using tickets.