[Qgis-developer] QGIS Server - GetPrint with a composer containing HTML block causes segfault

kimaidou kimaidou at gmail.com
Fri May 24 06:21:36 PDT 2013


Hi

I just opened a new issue : http://hub.qgis.org/issues/7894
Discussion can go on there.

Cheers
Michael


2013/5/24 kimaidou <kimaidou at gmail.com>

> Hi
>
> I just tested the same "long" text replacement passed in the parameter,
> but after unchecking the feature "Display in HTML". It appears that the
> behaviour is the same : when using this feature (dynamic strings for text
> item in composers) in the GetPrint request, QGIS does not respect the
> position and size of the text box. All the text is displayed in a single
> line which make the box "overflows" to the right.
>
> I have not yet find the specific server code wich handles this part, so I
> cannot propose a pull request for it.
>
> Michael
>
>
> 2013/5/23 kimaidou <kimaidou at gmail.com>
>
>> Ok, so I ran some more test. Here are the results
>>
>> I have set up a simple composer in QGIS (last master, compiled this
>> morning)
>> http://picpaste.com/Capture_du_2013-05-23_15_48_30-9NozmDib.png
>>
>> When I export in PDF from QGIS composer, I get this
>> http://temp-share.com/show/KdPfy1yuh
>>
>> When I ran the request [1] which is the getprint (wrapped by Lizmap, but
>> it is kind of a proxy to QGIS Server)
>> Basically I added the parameter truc=MY FOO TITLE <b>BOLD</b>
>> I get this :
>> http://temp-share.com/show/Pf3YjoO62
>>
>> When I ran the same request but with a longer "truc" parameter, like
>> &truc=MY FOO TITLE <b>BOLD</b><p>Lorem ipsum dolor sit amet, consectetur
>> adipiscing elit. Quisque luctus adipiscing fringilla. Fusce eget justo
>> tellus. Maecenas dolor augue, sollicitudin at iaculis et, congue et metus.
>> Aenean tincidunt ipsum sit amet ipsum ornare fermentum. Proin fringilla
>> laoreet hendrerit. Curabitur dui urna, interdum tempus blandit eu,</p>
>>
>> I get this:
>> http://temp-share.com/show/f3YgiOWwn
>>
>> So it appears that the dynamic replacement via the GetPrint request does
>> not respect the position and size of my "truc" text box. Have I missed
>> something or shall I report a bug ?
>>
>> Thanks in advance
>> Michael
>>
>> [1]
>> http://localhost/LIZMAP/lizmap-web-client/lizmap/www/index.php/lizmap/service/?repository=dev&project=dev_print&SERVICE=WMS&VERSION=1.3&REQUEST=GetPrint&FORMAT=pdf&EXCEPTIONS=application/vnd.ogc.se_inimage&TRANSPARENT=true&SRS=EPSG:3857&DPI=300&TEMPLATE=lizmap&map0:extent=423524.8086443924,5400434.830480828,431474.979630755,5410235.04125647&map0:rotation=0&map0:scale=49999.99999999999&LAYERS=commune&truc=MY%20FOO%20TITLE%20%3Cb%3EBOLD%3C/b%3E
>>
>>
>>
>> 2013/5/23 kimaidou <kimaidou at gmail.com>
>>
>>> Ok, new report here :
>>>
>>> * Instead of using an HTML item which forces to load an external html
>>> file, I just use a classical Text item. I have checked the "Display in
>>> HTML" checkbox
>>>
>>> * I setup an ID for this text box, for example "myid"
>>>
>>> * I can request the getPrint and add the parameter and content, for
>>> example
>>> ...&LAYERS=commune&myid=<h1>a small test</h1><br/><br/><p>lorem ipsum
>>> blablabl</p>
>>>
>>> * It seems to work, but I get a tiny tiny box with some unreadble text
>>> in it.
>>>
>>> I think I must pass some extra parameters to the fake X Server, like the
>>> screen size, etc.
>>>
>>> I will report further attempts
>>>
>>> Cheers
>>> Michael
>>>
>>>
>>> 2013/5/23 kimaidou <kimaidou at gmail.com>
>>>
>>>> I report my progress here
>>>>
>>>> I managed to get a PDF via the GetPrint request by following these steps
>>>>
>>>> 1/ Create a fake X server
>>>> Xvfb :99 -ac -noreset &
>>>>
>>>> 2/ Add the option in the fastcgi , for example
>>>>   FastCgiConfig -idle-timeout 70 -maxClassProcesses 50 -minProcesses 3
>>>> -init-start-delay 3 -restart-delay 20 -startDelay 15 -initial-env
>>>> DISPLAY=:99  LD_LIBRARY_PATH=/home/kimaidou/src/qgis/build/lib/
>>>>
>>>> 3/ Restart Apache
>>>> service apache2 restart
>>>>
>>>>
>>>> After this, I tried the GetPrint request from my QGIS project with a
>>>> composer containing a HTML item. The request get a PDF as an answer, but
>>>> the HTML item is empty.
>>>>
>>>> I will try with another composer, etc., and report here.
>>>>
>>>> By the way, is there a way to pass an HTML string via a parameter to
>>>> the getPrint request for HTML items, as it is possible for text item ? This
>>>> would rock !
>>>>
>>>> Michael
>>>>
>>>>
>>>> 2013/5/23 kimaidou <kimaidou at gmail.com>
>>>>
>>>>> Hi Tim and Marco
>>>>>
>>>>> I come back to this subject after helping to solve the performance
>>>>> problem with Mathias.
>>>>> So, I am first runnning my tests on my ubuntu laptop. Since it is my
>>>>> computer, it is not ubuntu server but the classical Ubuntu with an X server
>>>>> running.
>>>>>
>>>>> I tried in my terminal
>>>>> echo $DISPLAY
>>>>> :0
>>>>>
>>>>> So it seems (but I am far from being a X server guru !) that this is
>>>>> the DISPLAY value I should pass to QGIS Server.
>>>>> This is why I added the following configurartion in my virtual host
>>>>> (and in the fastcgi config file):
>>>>>
>>>>> In the virtual host
>>>>>         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>>>>>         <Directory "/usr/lib/cgi-bin">
>>>>>                 AllowOverride None
>>>>>                 Options +ExecCGI -MultiViews FollowSymLinks
>>>>>                 Order allow,deny
>>>>>                 Allow from all
>>>>>                 SetEnv LD_LIBRARY_PATH
>>>>> "/home/kimaidou/src/qgis/build/lib"
>>>>>                 SetEnv DISPLAY :0
>>>>>         </Directory>
>>>>>
>>>>>
>>>>> In /etc/apache2/mods-available/fastcgi.conf
>>>>>
>>>>> <IfModule mod_fastcgi.c>
>>>>>   AddHandler fastcgi-script .fcgi
>>>>>   #FastCgiWrapper /usr/lib/apache2/suexec
>>>>>   FastCgiIpcDir /var/lib/apache2/fastcgi
>>>>>   FastCgiConfig -idle-timeout 70 -maxClassProcesses 50 -minProcesses 3
>>>>> -init-start-delay 3 -restart-delay 20 -startDelay 15 -initial-env
>>>>> DISPLAY=:0 -initial-env LD_LIBRARY_PATH=/home/kimaidou/src/qgis/build/lib/
>>>>> </IfModule>
>>>>>
>>>>> I am pretty confident the default configuration is not used but I
>>>>> doubled it just in case
>>>>>
>>>>> After restarting my Apache Server, QGIS Server just hangs with the
>>>>> very simple URL
>>>>> http://localhost/cgi-bin/qgis_mapserv.fcgi
>>>>> which should reply with an error in XML format.
>>>>> So it seems Apache/QGIServer do not like my DISPLAY parameter.
>>>>>
>>>>> Any hint ?
>>>>> Would it be simplier to test this in a real server with no existing X
>>>>> Server by using Xfvb ?
>>>>>
>>>>> Michael
>>>>>
>>>>>
>>>>> 2013/5/22 Tim Sutton <lists at linfiniti.com>
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> You might also want to consider using Xfvb as a 'fake' xserver.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Tim
>>>>>>
>>>>>> On Wed, May 22, 2013 at 10:19 AM, kimaidou <kimaidou at gmail.com>
>>>>>> wrote:
>>>>>> > Thanks for your answer Marco. I will try to use the workaround you
>>>>>> described
>>>>>> > and report progress here.
>>>>>> >
>>>>>> > Michael
>>>>>> >
>>>>>> >
>>>>>> > 2013/5/22 Marco Hugentobler <marco.hugentobler at sourcepole.ch>
>>>>>> >>
>>>>>> >> Hi Michael
>>>>>> >>
>>>>>> >> I also encountered that problem. Unfortunately, it seems that
>>>>>> QWebKit
>>>>>> >> requires a running x-server. So it won't be possible to use html
>>>>>> items in
>>>>>> >> server projects (or you can run an x-server and set the DISPLAY
>>>>>> variable in
>>>>>> >> the fcgi conf).
>>>>>> >>
>>>>>> >> Regards,
>>>>>> >> Marco
>>>>>> >>
>>>>>> >> On 22.05.2013 09:43, kimaidou wrote:
>>>>>> >>
>>>>>> >> Hi list
>>>>>> >>
>>>>>> >> I have tried it with today's qgis master.
>>>>>> >>
>>>>>> >> I have a very simple project with one shapefile containing 3
>>>>>> polygones. I
>>>>>> >> created a composer with a map. GetPrint request works fine with
>>>>>> it. If I add
>>>>>> >> an HTML block in the composer (refering to one HTML file or not),
>>>>>> the
>>>>>> >> getPrint request raises a segfault.
>>>>>> >>
>>>>>> >> Apache error log is the well-known :
>>>>>> >> "Premature end of script headers: qgis_mapserv2.fcgi"
>>>>>> >>
>>>>>> >> By the way, I compiled QGIS with -DCMAKE_BUILD_TYPE=debug , but I
>>>>>> do not
>>>>>> >> know where I can find complet log for QGIS Server. Is there a file
>>>>>> where I
>>>>>> >> can get complete log for QGIS Server ?
>>>>>> >>
>>>>>> >> I can provide a sample project if needed. I have not found a
>>>>>> ticket in the
>>>>>> >> hub, so I will fill one, but I would prefer to do so with a
>>>>>> self-explaining
>>>>>> >> log.
>>>>>> >>
>>>>>> >> Michael
>>>>>> >>
>>>>>> >>
>>>>>> >> _______________________________________________
>>>>>> >> Qgis-developer mailing list
>>>>>> >> Qgis-developer at lists.osgeo.org
>>>>>> >> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>> >> --
>>>>>> >> Dr. Marco Hugentobler
>>>>>> >> Sourcepole -  Linux & Open Source Solutions
>>>>>> >> Weberstrasse 5, CH-8004 Zürich, Switzerland
>>>>>> >> marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
>>>>>> >> Technical Advisor QGIS Project Steering Committee
>>>>>> >>
>>>>>> >>
>>>>>> >> _______________________________________________
>>>>>> >> Qgis-developer mailing list
>>>>>> >> Qgis-developer at lists.osgeo.org
>>>>>> >> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>>>> >>
>>>>>> >
>>>>>> >
>>>>>> > _______________________________________________
>>>>>> > Qgis-developer mailing list
>>>>>> > Qgis-developer at lists.osgeo.org
>>>>>> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
>>>>>> ==============================================
>>>>>> Please do not email me off-list with technical
>>>>>> support questions. Using the lists will gain
>>>>>> more exposure for your issues and the knowledge
>>>>>> surrounding your issue will be shared with all.
>>>>>>
>>>>>> Visit http://linfiniti.com to find out about:
>>>>>>  * QGIS programming and support services
>>>>>>  * Mapserver and PostGIS based hosting plans
>>>>>>  * FOSS Consulting Services
>>>>>> Skype: timlinux
>>>>>> Irc: timlinux on #qgis at freenode.net
>>>>>> ==============================================
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130524/fe07c929/attachment.html>


More information about the Qgis-developer mailing list