Opened 16 years ago
Closed 16 years ago
#2406 closed defect (fixed)
Blank PDF on Mapserver 5.0 with FastCGI
Reported by: | ivanopicco | Owned by: | mapserverbugs |
---|---|---|---|
Priority: | normal | Milestone: | 5.0.1 release |
Component: | Output-PDF | Version: | 5.0 |
Severity: | major | Keywords: | |
Cc: | warmerdam, zjames |
Description
Map request with pdf as imagetype on Mapserv fastCGI returns blank (0 byte) file. The same mapfile and request work OK with shp2img, shp2pdf and cgi. Mapserv cgi is a simple copy from mapserv FastCGI binary, it was build from Mapserv 5.0.0 source code with ticket:2338 patch applied. Also tested without the patch. I used apache 2.2.4, mod_fcgid 2.1 and PDFlib-Lite-7.0.2 on CentOS release 4.5.
If more details are needed please let me know. Best Regards, Ivano
Debug log from CGI request:
Tue Nov 20 15:16:37 2007,5703,10.102.162.5,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution [Tue Nov 20 15:16:37 2007].401373 CGI Request 1 on process 5703 [Tue Nov 20 15:16:37 2007].406622 msDrawRasterLayerLow(w020n90): entering. [Tue Nov 20 15:16:37 2007].411209 msDrawGDAL(): src=0,0,4800,6000, dst=40,0,320,399
Debug log from FastCGI request:
Tue Nov 20 15:17:17 2007,2741,10.102.162.5,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution
Attachments (2)
Change History (16)
comment:1 by , 16 years ago
Cc: | added |
---|---|
Milestone: | → 5.2 release |
comment:2 by , 16 years ago
One additional question: does the FastCGI binary fail to produce output with any of the other renderers?
by , 16 years ago
Attachment: | valgrind_CGI_PDF.txt added |
---|
by , 16 years ago
Attachment: | valgrind_CGI_PNG.txt added |
---|
comment:3 by , 16 years ago
Replying to dmorissette:
Could you please try running that same request with the mapserv CGI under valgrind and see if it reports any error?
I found an error, both with PDF and GDAL/PNG renderers, see attachments...
Also, can you share a small testcase to reproduce?
I used a simple raster layer from a DEM file:
LAYER NAME "w020n90" DATA "/home/mapserver/data/w020n90/W020N90.DEM" TYPE RASTER STATUS ON DEBUG ON PROJECTION "init=epsg:4326" END END #LAYER
I think it can be reproducible with any raster layer.
A sample request: http://url/ms/raster?MODE=map&LAYER=w020n90&MAPEXT=-20%2040%2020%2090&MAPSIZE=400%20400&map.imagetype=pdf
Replying to zjames:
Jpeg: OK
Debug from FCGI
Wed Nov 21 08:47:03 2007,6624,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution
Debug from CGI
Wed Nov 21 08:47:26 2007,6841,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution [Wed Nov 21 08:47:26 2007].524365 CGI Request 1 on process 6841 [Wed Nov 21 08:47:26 2007].528530 msDrawRasterLayerLow(w020n90): entering. [Wed Nov 21 08:47:26 2007].533156 msDrawGDAL(): src=0,0,4800,6000, dst=40,0,320,399
Also with gif, GTiff and PNG
SVG: OK
Debug from FCGI
Wed Nov 21 09:01:54 2007,6624,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution
Debug from CGI
Wed Nov 21 09:02:34 2007,6853,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution [Wed Nov 21 09:02:34 2007].85839 CGI Request 1 on process 6853 [Wed Nov 21 09:02:34 2007].90497 msDrawRasterLayerLow(w020n90): entering. [Wed Nov 21 09:02:34 2007].95342 msDrawGDAL(): src=0,0,4800,6000, dst=40,0,320,399
SWF:OK
Debug from FCGI
Wed Nov 21 09:03:11 2007,6624,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution Wed Nov 21 09:03:16 2007,6624,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution
Debug from CGI
Wed Nov 21 09:06:03 2007,6859,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution [Wed Nov 21 09:06:03 2007].552485 CGI Request 1 on process 6859 [Wed Nov 21 09:06:03 2007].555944 msDrawRasterLayerLow(w020n90): entering. [Wed Nov 21 09:06:03 2007].560676 msDrawGDAL(): src=0,0,4800,6000, dst=40,0,320,399 Wed Nov 21 09:06:04 2007,6865,10.102.190.102,Prove,3,-25.000000 40.000000 25.000000 90.000000,-1.000000 -1.000000,w020n90 ,normal execution [Wed Nov 21 09:06:04 2007].513076 CGI Request 1 on process 6865 [Wed Nov 21 09:06:04 2007].516573 msDrawRasterLayerLow(w020n90): entering. [Wed Nov 21 09:06:04 2007].521294 msDrawGDAL(): src=0,0,4800,6000, dst=40,0,320,399
follow-up: 5 comment:4 by , 16 years ago
I had a look at the valgrind outputs, and I don't think that error in Exit() from main() is related to MapServer. I've seen this before with FGS builds and suspect it's related to the build or runtime environment doing something odd, but in general the binaries work fine anyway since the failure is only on Exit.
Since both PDF and PNG outputs fail then I don't think this can be called PDF-specific issue. BTW, does the PNG test also return a 0 byte output?
I see 3 possibilities:
1- FastCGI issue or side-effect: Can you try with a build without FastCGI and see if the problem goes away?
2- Build/runtime libs or environment problem: did you try the same mapfile on another machine?
3- Problem with this specific .DEM data file: in this case we'd need a testcase to reproduce.
comment:5 by , 16 years ago
Replying to dmorissette:
Since both PDF and PNG outputs fail then I don't think this can be called PDF-specific issue. BTW, does the PNG test also return a 0 byte output?
No,PNG is OK
I see 3 possibilities:
1- FastCGI issue or side-effect: Can you try with a build without FastCGI and see if the problem goes away?
I think it's unnecessary. I tried with the same binary without mod_fcgid and it works!! Because this, I think you are right: maybe this is a FastCGI side-effect or maybe an environment problem.
2- Build/runtime libs or environment problem: did you try the same mapfile on another machine?
I tested it also with line and point vectors from Oracle Spatial. Same as previous tests, it works as CGI and it doesn't work on FCGI only on PDF imagetype.
Mind the difference on debug output, it's different but the generated images are both OK, why ?
comment:6 by , 16 years ago
Scanning msSaveImagePDF() it appears that all output of the PDF to stdout is done using fwrite() and is presumably not being routed through the msIO_ layer which is required to return fastcgi stuff properly.
I can prepare a modification to mappdf.c if someone else can test it.
comment:7 by , 16 years ago
Franck, I am setup with factgi locally so I can do the initial tests. I can confirm right now that I get a blank output in fatscgi and a pdf doc in non fast cgi.
comment:8 by , 16 years ago
Milestone: | 5.2 release → 5.0.1 release |
---|
Assefa, I have modify fwrite() to be msIO_fwrite() in trunk (r7070). If this works fine for you it should be ported back into 5.0 branch as well. Milestone set accordingly.
follow-up: 11 comment:10 by , 16 years ago
back ported in 5.0.x r7071.
ivanopicco : please confirm that it works for you so we can close the bug.
comment:11 by , 16 years ago
comment:12 by , 16 years ago
Hi all, I made a simple mapfile you can use to reply my tests:
MAP NAME HELLO STATUS ON EXTENT 0 0 4000 3000 SIZE 400 300 IMAGECOLOR 255 200 255 WEB IMAGEPATH "/tmp/" IMAGEURL "/tmp/" END LAYER NAME "credits" STATUS DEFAULT TRANSFORM FALSE TYPE ANNOTATION FEATURE POINTS 200 150 END TEXT 'Hello World!' END CLASS LABEL TYPE BITMAP COLOR 0 0 0 END END END END
With this you get an image with an "Hello World!" in the middle. With a pdf request you get a blank pdf file with CGI (it's a white page, not void) and a empty file with FastCGI
A sample request: http://localhost/cgi-bin/mapserv?map=hello-world.map&MODE=map&map_imagetype=pdf
I hope it could be useful
comment:13 by , 16 years ago
I have retested with the map file provided and I get in both cases a valid empty pdf files. Not sure at this point why it does not work for you.
comment:14 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Don't mind me. I tried to rebuild all on another machine: it works. Thanks
Could you please try running that same request with the mapserv CGI under valgrind and see if it reports any error?
Also, can you share a small testcase to reproduce?