Re: [mapserver-users] AGG vs GD rendering shows no difference

2009-06-17 Thread Adrian Popa
I've managed to run mapserv through gdb, and my suspicions were 
confirmed - it dies in the AGG part:


...
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0xa3e000
[Thread debugging using libthread_db enabled]
[New Thread -1208244032 (LWP 18090)]

*Program received signal SIGSEGV, Segmentation fault.*
[Switching to Thread -1208244032 (LWP 18090)]
*0x00402b8c in agg::vertex_sequenceagg::vertex_dist, 6u::add () from 
/usr/lib/libagg.so.2*

(gdb) where
#0  0x00402b8c in agg::vertex_sequenceagg::vertex_dist, 6u::add () 
from /usr/lib/libagg.so.2
#1  0x00402c2f in agg::vertex_sequenceagg::vertex_dist, 
6u::modify_last () from /usr/lib/libagg.so.2

#2  0x004050e5 in agg::vcgen_stroke::add_vertex () from /usr/lib/libagg.so.2
#3  0x080d2f4c in agg::conv_adaptor_vcgenline_adaptor, 
agg::vcgen_stroke, agg::null_markers::vertex (this=0xbfdcdbf4, 
x=0xbfdcdc98, y=0xbfdcdca0)
   at 
/home/adrianp/mapserver/mapserver-5.4.1/../agg-2.5/include/agg_conv_adaptor_vcgen.h:115
#4  0x080e4206 in AGGMapserverRenderer::renderPolylineline_adaptor 
(this=0xa079968, p...@0xa081b58, col...@0xbfdcdf48, width=1, 
dashstylelength=0, dashstyle=0x9c27980,
   lc=agg::round_cap, lj=agg::round_join) at 
/home/adrianp/mapserver/mapserver-5.4.1/../agg-2.5/include/agg_rasterizer_scanline_aa.h:206
#5  0x080ccc46 in msDrawLineSymbolAGG (symbolset=0x9c2556c, 
image=0x9c4bb78, p=0xbfdce298, style=0x9c3ba18, scalefactor=1) at 
mapagg.cpp:1672
#6  0x080b331d in msDrawLineSymbol (symbolset=0x9c2556c, 
image=0x9c4bb78, p=0xbfdce298, style=0x9c3ba18, scalefactor=1) at 
mapdraw.c:2117
#7  0x080b1d4d in msDrawShape (map=0x9c25548, layer=0x9c3ae60, 
shape=0xbfdce298, image=0x9c4bb78, style=0, querymapMode=1) at 
mapdraw.c:1782
#8  0x080ae1eb in msDrawVectorLayer (map=0x9c25548, layer=0x9c3ae60, 
image=0x9c4bb78) at mapdraw.c:938
#9  0x080ad91d in msDrawLayer (map=0x9c25548, layer=0x9c3ae60, 
image=0x9c4bb78) at mapdraw.c:743

#10 0x080acb54 in msDrawMap (map=0x9c25548, querymap=0) at mapdraw.c:441
#11 0x080584b3 in main (argc=2, argv=0xbfdcea84) at mapserv.c:1417

I'll have to check to see if there are known bugs regarding AGG...

Adrian Popa wrote:

Thank you for your suggestion Andreas,

I have run shp2img and unfortunately:
[r...@terra tmp]# shp2img -o /tmp/out.png -m 
/var/www/html/msmap/dynamicmaps/fibUaBrx.map -e 20.258 
43.16 29.703 49.2016 -s 1250 800 -l GranitaJudete 
Judete Urban Rural RuralSate buildings fibra fiber-common fiber-STM64 
fiber-STM16 fiber-STM4 fiber-STM1 fiber-problems-main 
fiber-problems-related fibraProblems

*Segmentation fault*

Running the command through strace, it ends up like this:


read(4, h\376\237\224O\320;@p\225\4\25\'x...@\264d\270^\320;@\26..., 
45056) = 45056
read(4, \303\362oU\36\206;@by\237\354...@\34\271\214\333\37\206..., 
4096) = 4096

_llseek(9, 12288, [12288], SEEK_SET)= 0
read(9, ..., 4096) = 148
_llseek(4, 1458176, [1458176], SEEK_SET) = 0
read(4, \25\327\377\332\27\...@\30\256\23v9|;@\233M%\235\372\22..., 
24576) = 24576
read(4,  a\1$\203\...@.\245\211px 
;@\314\353\330\355\242\...@\367..., 4096) = 1784

close(8)= 0
munmap(0xb7f36000, 4096)= 0
close(4)= 0
munmap(0xb7f38000, 4096)= 0
close(9)= 0
munmap(0xb7f35000, 4096)= 0
gettimeofday({1245157506, 462482}, NULL) = 0
gettimeofday({1245157506, 462600}, NULL) = 0
open(/etc/localtime, O_RDONLY)= 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f38000
read(4, TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\7\0\0\0\7\0..., 
4096) = 798

close(4)= 0
munmap(0xb7f38000, 4096)= 0
gettimeofday({1245157506, 463468}, NULL) = 0
gettimeofday({1245157506, 463535}, NULL) = 0
gettimeofday({1245157506, 463599}, NULL) = 0
gettimeofday({1245157506, 463664}, NULL) = 0
gettimeofday({1245157506, 463734}, NULL) = 0
gettimeofday({1245157506, 463802}, NULL) = 0
gettimeofday({1245157506, 463866}, NULL) = 0
gettimeofday({1245157506, 463934}, NULL) = 0
gettimeofday({1245157506, 464028}, NULL) = 0
*open(/var/www/html/msmap/dynamicmaps/../data/Judete.shp, 
O_RDONLY|O_LARGEFILE) = 4*
open(/var/www/html/msmap/dynamicmaps/../data/Judete.shx, 
O_RDONLY|O_LARGEFILE) = 8

fstat64(4, {st_mode=S_IFREG|0555, st_size=1484536, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f38000
*read(4*, \0\0\'\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\vS|..., 
4096) = 4096

fstat64(8, {st_mode=S_IFREG|0555, st_size=436, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f36000
read(8, \0\0\'\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..., 
4096) = 436

Re: [mapserver-users] AGG vs GD rendering shows no difference

2009-06-17 Thread Adrian Popa

Hello everyone!

After a few hours of digging, I managed to solve the problem.
I checked mapserver's dependencies and it was linked against agg 2.3:
[r...@terra tmp]# ldd /var/www/cgi-bin/mapserv | grep agg
   libagg.so.2 = /usr/lib/libagg.so.2 (0x003f5000)

lrwxrwxrwx 1 root root 15 Jun 15 10:31 /usr/lib/libagg.so - 
libagg.so.2.0.1
lrwxrwxrwx 1 root root 15 Jun 15 10:31 /usr/lib/libagg.so.2 - 
libagg.so.2.0.1

-rwxr-xr-x 1 root root 228524 Feb 17  2006 /usr/lib/libagg.so.2.0.1

However, when I compiled mapserver I pointed the AGG code (--with-agg) 
to version 2.5.


So mapserver had been compiled against agg 2.5 but was running with agg 
2.3. This caused the segfault when using agg.


The solution is to compile AGG2.5 and to install it in the system.
Unfortunately, the AGG documentation is scarce and doesn't clearly say 
how to compile the code, and even if I'm a linux seasoned user, I failed 
to see the autogen.sh script.

Here's how I compiled AGG:
*sh 
autogen.sh   

./configure --disable-platform --disable-examples 
--prefix=/usr 

make


make install  *


And now, I have also the newer libs in my /usr/lib/ directory:
[r...@terra mapserver]# ls -l /usr/lib/libagg*
-rw-r--r-- 1 root root 1313570 Jun 17 17:06 /usr/lib/libagg.a
-rw-r--r-- 1 root root  395874 Jun 17 17:06 /usr/lib/libaggfontfreetype.a
-rwxr-xr-x 1 root root 897 Jun 17 17:06 /usr/lib/libaggfontfreetype.la
lrwxrwxrwx 1 root root  27 Jun 17 17:06 
/usr/lib/libaggfontfreetype.so - libaggfontfreetype.so.2.0.4
lrwxrwxrwx 1 root root  27 Jun 17 17:06 
/usr/lib/libaggfontfreetype.so.2 - libaggfontfreetype.so.2.0.4
-rwxr-xr-x 1 root root  283338 Jun 17 17:06 
/usr/lib/libaggfontfreetype.so.2.0.4

-rwxr-xr-x 1 root root 785 Jun 17 17:06 /usr/lib/libagg.la
-rw-r--r-- 1 root root   53282 Feb 17  2006 /usr/lib/libaggplatformX11.a
lrwxrwxrwx 1 root root  26 Jun 15 10:31 
/usr/lib/libaggplatformX11.so - libaggplatformX11.so.2.0.1
lrwxrwxrwx 1 root root  26 Jun 15 10:31 
/usr/lib/libaggplatformX11.so.2 - libaggplatformX11.so.2.0.1
-rwxr-xr-x 1 root root   43468 Feb 17  2006 
/usr/lib/libaggplatformX11.so.2.0.1
lrwxrwxrwx 1 root root  15 Jun 17 17:06 /usr/lib/libagg.so - 
libagg.so.2.0.4
lrwxrwxrwx 1 root root  15 Jun 17 17:06 /usr/lib/libagg.so.2 - 
libagg.so.2.0.4

-rwxr-xr-x 1 root root  228524 Feb 17  2006 /usr/lib/libagg.so.2.0.1
-rwxr-xr-x 1 root root  774469 Jun 17 17:06 /usr/lib/libagg.so.2.0.4

And mapserver renders my maps very well (see attached photos)

Thank you all for your help!
Regards,
Adrian

inline: agg.pnginline: png.png___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] AGG vs GD rendering shows no difference

2009-06-16 Thread Andreas Albarello

Adrian Popa wrote:

The original mapfile had rendering set up like this:
IMAGETYPE PNG

while the new mapfile has rendering set up like this:
IMAGETYPE PNG
OUTPUTFORMAT

   NAME 'AGG'
   DRIVER AGG/PNG

  IMAGEMODE RGB
END 


Adrian,

you'll most likely need to write

IMAGETYPE 'AGG'

instead of

IMAGETYPE PNG

to make sure your new outputformat is used.

Best regards,

--

Andreas Albarello
Analysis  SW Development

Territorium Online srl/GmbH
Via Buozzi Str. 12
I 39100 Bolzano/Bozen

Phone:  +39 0471 068611
Fax:+39 0471 068619

email: andreas.albare...@territoriumonline.com
web:   http://www.territoriumonline.com

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] AGG vs GD rendering shows no difference

2009-06-16 Thread Adrian Popa

Thank you for your suggestion.

I have corrected the mapfile ( added IMAGETYPE 'AGG'), however, when I 
try to load the map, I get a 500 web server error:


[Tue Jun 16 13:43:25 2009] [error] [client 80.97.196.77] Premature end 
of script headers: mapserv, referer: http://terra/msmap/testmap.pl


It seems to me that mapserv dies and doesn't output any headers back. 
How could I find out the error message?
I already have a log statement in my WEB section: LOG 
/var/www/html/map.log (the file is writable by apache)


Unfortunately I don't get anything in this log.

My mapserver supports:

[r...@terra html]# /var/www/cgi-bin/mapserv -v
MapServer version 5.4.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER 
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER 
SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR 
INPUT=GDAL INPUT=MYGIS INPUT=SHAPEFILE


Any ideas how to debug this?

Thanks

Andreas Albarello wrote:

Adrian Popa wrote:

The original mapfile had rendering set up like this:
IMAGETYPE PNG

while the new mapfile has rendering set up like this:
IMAGETYPE PNG
OUTPUTFORMAT

   NAME 'AGG'
   DRIVER AGG/PNG

  IMAGEMODE RGB
END 


Adrian,

you'll most likely need to write

IMAGETYPE 'AGG'

instead of

IMAGETYPE PNG

to make sure your new outputformat is used.

Best regards,




___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] AGG vs GD rendering shows no difference

2009-06-16 Thread David Nugent
On Tue, 16 Jun 2009 20:58:22 +1000, Adrian Popa  
adrian_gh.p...@romtelecom.ro wrote:



Thank you for your suggestion.

I have corrected the mapfile ( added IMAGETYPE 'AGG'), however, when I  
try to load the map, I get a 500 web server error:


[Tue Jun 16 13:43:25 2009] [error] [client 80.97.196.77] Premature end  
of script headers: mapserv, referer: http://terra/msmap/testmap.pl


It seems to me that mapserv dies and doesn't output any headers back.  
How could I find out the error message?


The first place to check is the web server log. HTTP errors (and 500 is  
one) are usually visible there. I'm guessing that mapserver has a problem  
parsing the map file and you can usually discover the line it is having a  
problem with in the web server's log.


The second level of logging is:

CONFIG MS_ERRORFILE path_to_mapserver.log

which provides more detail, but you usually have to configure DEBUG ON (or  
DEBUG 1-5) as well for this to be useful.



Regards,
David
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] AGG vs GD rendering shows no difference

2009-06-16 Thread Andreas Albarello


On 16 Jun 2009, at 14:25, Adrian Popa wrote:


Hello David,

I got the 500 errors from the http error log file. Unfortunately no  
additional information is provided.
I added the MS_ERRORFILE and DEBUG statements to my map file and  
although the errorfile is created, I don't get any other information  
(neither when the map loads perfectly, nor when it dies with  
premature end of script headers.


I read RFC 28 (http://mapserver.org/development/rfc/ms-rfc-28.html)  
and they specified that the server should be compiled with - 
DENABLE_STDERR_DEBUG, so I recompiled mapserver:
CFLAGS=-DENABLE_STDERR_DEBUG ./configure  --with-freetype --with-png  
--with-agg=../agg-2.5 --with-proj --with-ogr --with-gdal --with-xml2  
--with-wfs --with-wcs --with-wmsclient --with-wfsclient --with- 
postgis --with-threads --with-sos --with-mygis --with-geos --with-tiff


I used the new binary and unfortunately nothing changed :(

My (relevant part of the) mapfile looks like this:

MAP
CONFIG  MS_ERRORFILE /tmp/mapserver.log
CONFIG  MS_DEBUGLEVEL 5
DEBUG 5...
END

What else can I try?


Try to bypass the webserver/CGI stuff and launch shp2img directly from  
the shell, that should hopefully yield some better output:


shp2img -o test.png -m mapfile.map

If you haven't already done so in your mapfile, you might need to add  
an image size (-s 500 500) and/or an extent (-e minx miny maxx maxy)  
to the above command line options.


Best regards,
--

Andreas Albarello
Analysis  SW Development

Territorium Online srl/GmbH
Via Buozzi/Buozzistraße 12 - I 39100 Bolzano/Bozen
email: andreas.albare...@territoriumonline.com
web:   www.territoriumonline.com


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] AGG vs GD rendering shows no difference

2009-06-16 Thread Adrian Popa

Thank you for your suggestion Andreas,

I have run shp2img and unfortunately:
[r...@terra tmp]# shp2img -o /tmp/out.png -m 
/var/www/html/msmap/dynamicmaps/fibUaBrx.map -e 20.258 
43.16 29.703 49.2016 -s 1250 800 -l GranitaJudete Judete 
Urban Rural RuralSate buildings fibra fiber-common fiber-STM64 
fiber-STM16 fiber-STM4 fiber-STM1 fiber-problems-main 
fiber-problems-related fibraProblems

*Segmentation fault*

Running the command through strace, it ends up like this:


read(4, h\376\237\224O\320;@p\225\4\25\'x...@\264d\270^\320;@\26..., 
45056) = 45056
read(4, \303\362oU\36\206;@by\237\354...@\34\271\214\333\37\206..., 
4096) = 4096

_llseek(9, 12288, [12288], SEEK_SET)= 0
read(9, ..., 4096) = 148
_llseek(4, 1458176, [1458176], SEEK_SET) = 0
read(4, \25\327\377\332\27\...@\30\256\23v9|;@\233M%\235\372\22..., 
24576) = 24576
read(4,  a\1$\203\...@.\245\211px ;@\314\353\330\355\242\...@\367..., 
4096) = 1784

close(8)= 0
munmap(0xb7f36000, 4096)= 0
close(4)= 0
munmap(0xb7f38000, 4096)= 0
close(9)= 0
munmap(0xb7f35000, 4096)= 0
gettimeofday({1245157506, 462482}, NULL) = 0
gettimeofday({1245157506, 462600}, NULL) = 0
open(/etc/localtime, O_RDONLY)= 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=798, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f38000
read(4, TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\7\0\0\0\7\0..., 
4096) = 798

close(4)= 0
munmap(0xb7f38000, 4096)= 0
gettimeofday({1245157506, 463468}, NULL) = 0
gettimeofday({1245157506, 463535}, NULL) = 0
gettimeofday({1245157506, 463599}, NULL) = 0
gettimeofday({1245157506, 463664}, NULL) = 0
gettimeofday({1245157506, 463734}, NULL) = 0
gettimeofday({1245157506, 463802}, NULL) = 0
gettimeofday({1245157506, 463866}, NULL) = 0
gettimeofday({1245157506, 463934}, NULL) = 0
gettimeofday({1245157506, 464028}, NULL) = 0
*open(/var/www/html/msmap/dynamicmaps/../data/Judete.shp, 
O_RDONLY|O_LARGEFILE) = 4*
open(/var/www/html/msmap/dynamicmaps/../data/Judete.shx, 
O_RDONLY|O_LARGEFILE) = 8

fstat64(4, {st_mode=S_IFREG|0555, st_size=1484536, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f38000
*read(4*, \0\0\'\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\vS|..., 
4096) = 4096

fstat64(8, {st_mode=S_IFREG|0555, st_size=436, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f36000
read(8, \0\0\'\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..., 
4096) = 436
open(/var/www/html/msmap/dynamicmaps/../data/Judete.dbf, 
O_RDONLY|O_LARGEFILE) = 9

fstat64(9, {st_mode=S_IFREG|0555, st_size=12436, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f35000
read(9, \3k\6\24*\0\0\0\201\0%\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..., 
4096) = 4096

_llseek(9, 0, [0], SEEK_SET)= 0
read(9, \3k\6\24*\0\0\0\201\0%\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..., 
4096) = 4096

_llseek(8, 0, [0], SEEK_SET)= 0
read(8, \0\0\'\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..., 
4096) = 436

read(8, , 4096)   = 0
_llseek(4, 0, [0], SEEK_SET)= 0
*read(4*, \0\0\'\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\vS|..., 
4096) = 4096
*read(4,* 
\...@by\233\300\226bg@\342\376\n\341\34...@\266mo\267\241..., 49152) = 
49152
*read(4,* ]\3...@\34\21\376\224 +...@g\245\\8\247\3356@6\277\213.\f..., 
4096) = 4096

--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 20970 detached


I'm not sure if it faults because it can't read from file handler 4 
(Judete.shp), or if it's something else... I also tried by not 
specifying Judete in the layer list, but it still dies (while reading 
Judete.shp!).


I will look further into problems with AGG (because it renders fine with 
PNG)


Thank you for your help - now I know where to look.
Regards,
Adrian

P.S. Ideas are welcome!

Andreas Albarello wrote:


On 16 Jun 2009, at 14:25, Adrian Popa wrote:


Hello David,

I got the 500 errors from the http error log file. Unfortunately no 
additional information is provided.
I added the MS_ERRORFILE and DEBUG statements to my map file and 
although the errorfile is created, I don't get any other information 
(neither when the map loads perfectly, nor when it dies with 
premature end of script headers.


I read RFC 28 (http://mapserver.org/development/rfc/ms-rfc-28.html) 
and they specified that the server should be compiled with 
-DENABLE_STDERR_DEBUG, so I recompiled mapserver:
CFLAGS=-DENABLE_STDERR_DEBUG ./configure  --with-freetype --with-png 
--with-agg=../agg-2.5 --with-proj --with-ogr --with-gdal --with-xml2 
--with-wfs --with-wcs --with-wmsclient --with-wfsclient