Opened 12 years ago

Last modified 12 years ago

#4237 assigned defect

LABEL LEADER Crash

Reported by: woodbri Owned by: tbonfort
Priority: normal Milestone: 6.2 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc:

Description

Thomas,

The RFC needs to be updated with examples that should how the mapfile should be constructed based on your implementation. Between reading the code and guess I can up with the follow class definition which is probably not right, but it give a segv.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fca85f82710 (LWP 2642)]
0x00007fca7dcf9a65 in free () from /lib/libc.so.6
(gdb) bt
#0  0x00007fca7dcf9a65 in free () from /lib/libc.so.6
#1  0x00007fca85bdb363 in msFreeLabelCacheSlot ()
   from /usr/local/lib/libmapserver-6.1-dev.so
#2  0x00007fca85bdb5e1 in msFreeLabelCache ()
   from /usr/local/lib/libmapserver-6.1-dev.so
#3  0x00007fca85c7fd0f in msFreeMap ()
   from /usr/local/lib/libmapserver-6.1-dev.so
#4  0x00007fca85ba73fe in msFreeMapServObj ()
   from /usr/local/lib/libmapserver-6.1-dev.so
#5  0x00000000004011e3 in main ()

In my mapfile I have the following class definition.

  CLASS
    MAXSCALEDENOM 100000000
    MINSCALEDENOM  50000000
    TEXT ('[STUSPS]')
    STYLE
      COLOR "#f2efe9"
    END
    LABEL
      LEADER
        MAXDISTANCE 30
        GRIDSTEP 5
        STYLE  #  draw the leader
          COLOR "#000000"
          WIDTH 1.0
        END
      END
      # this might need to go in the LEADER block 
      # with geomtransform 'start'
      STYLE # put a dot at the object location
        SYMBOL "circle"
        SIZE 3
        COLOR "#000000"
      END
      COLOR "#675844"
      FONT "arial"
      TYPE TRUETYPE
      SIZE 6
      POSITION CC
      PARTIALS FALSE
      BUFFER 2
      MINDISTANCE 100
    END
  END

Change History (9)

comment:1 by tbonfort, 12 years ago

Owner: changed from sdlime to tbonfort
Status: newassigned

can you post your full layer definition, and the backtrace with debugging symbols enabled?

comment:2 by tbonfort, 12 years ago

I was unable to reproduce the error with this class definition, and valgrind does not report any leaked memory. I have also updated trunk in r13231 to output an error message with that layer definition, as for the time being LEADER is only supported at the CLASS level, not the LABEL level.

comment:3 by woodbri, 12 years ago

ok, r13231 now reports this message and does not crash:

[Mon Mar 12 09:05:58 2012].132886 loadLabel(): General error message. LABEL LEADER not implemented. LEADER goes at the CLASS level.

Can you post a simple example of using a leader line so I can see where the basic pieces go. For example, a dot at the object and a leader to the label, like the graphic in the rfc.

comment:4 by tbonfort, 12 years ago

I would still like to get the debug backtrace before r13231, as it is probably revealing something else.

The initial (and current) implementation of leaders will not play nicely in most cases if you need a marker and a label text (there are many more configuration options that need to be added: should the marker be offseted or kept at the original location, can the leader line intersect the label text and /or markers, etc...)

CLASS
 LEADER
  MAXDISTANCE 30
  STYLE
   COLOR 0 0 0
   WIDTH 1
  END
 END
 LABEL
  FONT TRUETYPE
  POSITION AUTO
  ...
 END
END

comment:5 by woodbri, 12 years ago

Ok, thanks, I think I have the leader syntax. But it looks like MINDISTANCE is being ignored in the new code.

http://imaptools.com:8080/demo/tiger2011.html?zoom=2&lat=40.59521&lon=-91.20341&layers=00B0

In layer switch (6.1a) is getting converted to use the new syntax.

    LAYER
        NAME "state_far"
        METADATA
            "ows_title"     "State polygons"
            "ows_srs"       "EPSG:4269 EPSG:4326"
            "ows_abstract"  "State polygon features from the U.S. Census STATE data layer."
        END
        TYPE POINT
        DATA "STATE/tl_2011_us_state_pt"
        PROJECTION
            "+proj=longlat +ellps=GRS80 +datum=NAD83" #EPSG: 4269
        END
        INCLUDE "map-STATE-F.inc"
    END

and the include:

  # map-STATE.inc
  CLASS
    MAXSCALEDENOM 100000000
    MINSCALEDENOM  50000000
    TEXT ('[STUSPS]')
    STYLE
      COLOR "#f2efe9"
    END
    LEADER
      MAXDISTANCE 30
      GRIDSTEP 5
      STYLE
        COLOR "#000000"
        WIDTH 1.0
      END
    END
    LABEL
      COLOR "#675844"
      FONT "arial"
      TYPE TRUETYPE
      SIZE 6
      POSITION CC
      PARTIALS FALSE
      BUFFER 2
      MINDISTANCE 200
    END
  END
  CLASS
    MAXSCALEDENOM  50000000
    MINSCALEDENOM  20000000
    TEXT ('[NAME]')
    STYLE
      COLOR "#f2efe9"
    END
    LEADER
      MAXDISTANCE 30
      GRIDSTEP 5
      STYLE
        COLOR "#000000"
        WIDTH 1.0
      END
    END
    LABEL
      COLOR "#675844"
      FONT "sans-bold"
      TYPE TRUETYPE
      SIZE 7
      POSITION CC
      PARTIALS FALSE
      WRAP ' '
      ALIGN CENTER
      BUFFER 2
      MINDISTANCE 200
    END
  END
  CLASS
    MAXSCALEDENOM  20000000
    MINSCALEDENOM   5000000
    TEXT ('[NAME]')
    STYLE
      COLOR "#f2efe9"
    END
    LEADER
      MAXDISTANCE 30
      GRIDSTEP 5
      STYLE
        COLOR "#000000"
        WIDTH 1.0
      END
    END
    LABEL
      COLOR "#675844"
      FONT "sans-bold"
      TYPE TRUETYPE
      SIZE 8
      POSITION CC
      PARTIALS FALSE
      WRAP ' '
      ALIGN CENTER
      BUFFER 2
      MINDISTANCE 200
    END
  END

comment:6 by woodbri, 12 years ago

Also, if you zoom out one level, I get the following crash:

mapserv: mapsymbol.c:83: msSymbolGetDefaultSize: Assertion `s->pixmap_buffer != ((void *)0)' failed.
Aborted

gdb info:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7f7a56ce6710 (LWP 12327)]
0x00007f7a4e964ed5 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007f7a4e964ed5 in raise () from /lib/libc.so.6
#1  0x00007f7a4e9663f3 in abort () from /lib/libc.so.6
#2  0x00007f7a4e95ddc9 in __assert_fail () from /lib/libc.so.6
#3  0x00007f7a568d530c in msSymbolGetDefaultSize (s=0x1cfeed0)
    at mapsymbol.c:83
#4  0x00007f7a568d71d9 in msGetMarkerSize (symbolset=0x1c8fc80,
    style=0x1dc91d0, width=0x7ffffdc61038, height=0x7ffffdc61030,
    scalefactor=1) at mapsymbol.c:663
#5  0x00007f7a5695a0d1 in computeLabelMarkerPoly (map=0x1c8fc50,
    img=0x1c934f0, cachePtr=0x1d14310, label=0x1dc8f70,
    markerPoly=0x7ffffdc611b0) at mapdraw.c:2616
#6  0x00007f7a5695ae58 in msDrawLabelCache (image=0x1c934f0, map=0x1c8fc50)
    at mapdraw.c:2838
#7  0x00007f7a5694f081 in msDrawMap (map=0x1c8fc50, querymap=0)
    at mapdraw.c:493
#8  0x00007f7a5693e1dc in msWMSGetMap (map=0x1c8fc50, nVersion=65793,
    names=0x1c8e940, values=0x1c8ec70, numentries=13,
    wms_exception_format=0x1c8f980 "application/vnd.ogc.se_inimage",
    ows_request=0x7ffffdc617b0) at mapwms.c:4025
#9  0x00007f7a56942d3f in msWMSDispatch (map=0x1c8fc50, req=0x1c8e900,
    ows_request=0x7ffffdc617b0, force_wms_mode=0) at mapwms.c:5443
#10 0x00007f7a5697f62e in msOWSDispatch (map=0x1c8fc50, request=0x1c8e900,
    ows_mode=-1) at mapows.c:275
#11 0x00007f7a569e2fb6 in msCGIDispatchRequest (mapserv=0x1c8e6c0)
    at mapservutil.c:1631
#12 0x00000000004012ed in main (argc=2, argv=0x7ffffdc61988) at mapserv.c:201
(gdb) up3
Undefined command: "up3".  Try "help".
(gdb) up 3
#3  0x00007f7a568d530c in msSymbolGetDefaultSize (s=0x1cfeed0)
    at mapsymbol.c:83
83            assert(s->pixmap_buffer != NULL);
(gdb) p s*
A syntax error in expression, near `'.
(gdb) p *s
$1 = {name = 0x1ceca30 "city_3", type = 1003, inmapfile = 0, map = 0x0,
  sizex = 1, sizey = 1, minx = 0, miny = 0, maxx = 0, maxy = 0, points = {{
      x = 0, y = 0} <repeats 100 times>}, refcount = 1, numpoints = 0,
  filled = 0, anchorpoint_x = 0.5, anchorpoint_y = 0.5, renderer = 0x0,
  pixmap_buffer = 0x0, renderer_cache = 0x0, full_font_path = 0x0,
  full_pixmap_path = 0x1ce26e0 "/u/data/tiger2011-maps/etc/icons2/city/city_3.png", svg_cairo_surface = 0x0, imagepath = 0x1cd7cc0 "icons2/city/city_3.png",
  transparent = 0, transparentcolor = 0, character = 0x0, antialias = 0,
  font = 0x0, svg_text = 0x0}
(gdb)

comment:7 by woodbri, 12 years ago

Sorry, I tried to revert everything back to pre r13231 to get the gdb backtrace, but I could not generate the error again. I'm not sure what I was missing.

comment:8 by tbonfort, 12 years ago

r13232 should fix the pixmap_buffer assertion

comment:9 by tbonfort, 12 years ago

r13237: label MINDISTANCE should now be taken into account for leader offsetted labels

Note: See TracTickets for help on using tickets.